From 0c9175666850a04cbf8dea0036d04b532bd59a2c Mon Sep 17 00:00:00 2001
From: Wincent Colaiuta
Date: Sat, 11 Jan 2014 14:03:18 -0500
Subject: [PATCH] Remove profiling_parse cruft
I'm not doing any profiling right now and haven't for a while, so let's
clean out the cruft.
Signed-off-by: Wincent Colaiuta
---
benchmarks/profile_parsing.rb | 338 ----------------------------------
doc/rdoc.rb | 12 --
ext/wikitext/parser.c | 9 +-
ext/wikitext/parser.h | 4 +-
ext/wikitext/wikitext.c | 3 +-
5 files changed, 3 insertions(+), 363 deletions(-)
delete mode 100755 benchmarks/profile_parsing.rb
diff --git a/benchmarks/profile_parsing.rb b/benchmarks/profile_parsing.rb
deleted file mode 100755
index 581d001..0000000
--- a/benchmarks/profile_parsing.rb
+++ /dev/null
@@ -1,338 +0,0 @@
-#!/usr/bin/env ruby
-# Copyright 2008-2013 Wincent Colaiuta. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-require File.join(File.dirname(__FILE__), '..', 'ext', 'wikitext')
-require 'benchmark'
-
-# 91 characters, 91 bytes
-short_slab_of_ASCII_text = '* Lorem [[ipsum|hello]] dolor sit amet, `consectetuer` http://example.com/ adipiscing elit.'
-
-# compare against the expected output to ensure correctness
-short_slab_of_ASCII_text_output = <
- Lorem hello dolor sit amet, consectetuer http://example.com/ adipiscing elit.
-
-SLAB
-
-# 91 characters, 122 bytes
-short_slab_of_UTF8_text = '* Lórâ¬m [[ïpsûm|hâ¬llö]] dólór sït à mâ¬t, `cóñsâ¬ctâ¬tûâ¬r` http://example.com/ à dïpïscïñg â¬lït.'
-
-short_slab_of_UTF8_text_output = <
- Lór€m h€llö dólór sït àm€t, cóñs€ct€tû€r http://example.com/ àdïpïscïñg €lït.
-
-SLAB
-
-# 1415 characters, 1415 bytes
-longer_slab_of_ASCII_text = < a blockquote
-> second line of blockquote
->
-> new paragraph within blockquote
-
-== another heading ==
-
-paragraph within ''multiple '''styles''''' and tt span
-
-similar, but with '''styles in ''different'' order'''
-
-again, a '''different ''order'''''
-
-* list item 1
-** nested list item 1
-** nested list item 2
-** nested list item 3
-* list item 2
-
- // this is a code block
- notice how it can contain ''markup''
- which would '''otherwise''' have special meaning
- although explicit entities © are passed through unchanged
-
-a normal paragraph again
-
-This is where we show a link to an article on [[GCC]].
-Related to that, [[GCC|a link]] to the same
-article but with custom link text.
-
-External links [http://example.com work too].
-As well as autolinks as seen http://example.com/
-here.
-
-Look at how we handle bad syntax. [[This is an unterminated
-link. And [http://example.com/ is another.
-
-# this is an ordered list
-# which continues
-## and has another ordered list
-## nested inside it
-# and then falls back
-#* and then nests another list
-#* this time an unordered one
-#** itself containing a nested list
-#** which continues
-#**# and finally nests yet another ordered list
-#**# which continues
-#* drops back quite a way
-# and finally all the way
-#****** and finishes with an invalid item
-
-=== heading with missing closing tag
-* list
-# new list
-SLAB
-
-longer_slab_of_ASCII_text_output = <paragraph second line
-new paragraph
-a heading
-
- a blockquote second line of blockquote
- new paragraph within blockquote
-
-another heading
-paragraph within multiple styles and tt span
-similar, but with styles in different order
-again, a different order
-
- - list item 1
-
- - nested list item 1
- - nested list item 2
- - nested list item 3
-
-
- - list item 2
-
-// this is a code block
-notice how it can contain ''markup''
-which would '''otherwise''' have <tt>special</tt> meaning
-although explicit entities © are passed through unchanged
-a normal paragraph again
-This is where we show a link to an article on GCC. Related to that, a link to the same article but with custom link text.
-External links work too. As well as autolinks as seen http://example.com/ here.
-Look at how we handle bad syntax. [[This is an unterminated link. And [http://example.com/ is another.
-
- - this is an ordered list
- - which continues
-
- - and has another ordered list
- - nested inside it
-
-
- - and then falls back
-
- - and then nests another list
- - this time an unordered one
-
- - itself containing a nested list
- - which continues
-
- - and finally nests yet another ordered list
- - which continues
-
-
-
-
- - drops back quite a way
-
-
- - and finally all the way
-
- - ***** and finishes with an invalid item
-
-
-
-heading with missing closing tag
-
-
- - new list
-
-SLAB
-
-# 1415 characters, 2061 bytes
-longer_slab_of_UTF8_text = < ä blöckquötâ¬
-> â«â¬cöñd lîñ⬠öf blöckquötâ¬
->
-> ñâ¬w pärägräph wîthîñ blöckquötâ¬
-
-== äñöthâ¬r hâ¬Ã¤dîñg ==
-
-pärägräph wîthîñ ''multîpl⬠'''â«tylâ¬â«''''' äñd tt â«päñ
-
-â«Ã®mîlär, but wîth '''â«tylâ¬â« îñ ''dîffâ¬râ¬Ã±t'' ördâ¬r'''
-
-ägäîñ, ä '''dîffâ¬râ¬Ã±t ''ördâ¬r'''''
-
-* lîâ«t îtâ¬m 1
-** ñâ¬â«tâ¬d lîâ«t îtâ¬m 1
-** ñâ¬â«tâ¬d lîâ«t îtâ¬m 2
-** ñâ¬â«tâ¬d lîâ«t îtâ¬m 3
-* lîâ«t îtâ¬m 2
-
- // thî⫠î⫠ä cöd⬠blöck
- ñötîc⬠höw ît cäñ cöñtäîñ ''märkup''
- whîch wöuld '''öthâ¬rwîâ«â¬''' häv⬠â«pâ¬cîäl mâ¬Ã¤Ã±Ã®Ã±g
- älthöugh â¬xplîcît â¬Ã±tîtîâ¬â« &cöpy; är⬠päâ«â«â¬d thröugh uñchäñgâ¬d
-
-ä ñörmäl pärägräph ägäîñ
-
-Thî⫠î⫠whâ¬r⬠w⬠â«höw ä lîñk tö äñ ärtîcl⬠öñ [[GCC]].
-Râ¬lätâ¬d tö thät, [[GCC|ä lîñk]] tö th⬠â«Ã¤mâ¬
-ärtîcl⬠but wîth cuâ«töm lîñk tâ¬xt.
-
-Extâ¬rñäl lîñkâ« [http://example.com wörk töö].
-Aâ« wâ¬ll ä⫠äutölîñk⫠ä⫠â«â¬â¬Ã± http://example.com/
-herâ¬.
-
-Löök ät höw w⬠häñdl⬠bäd â«yñtäx. [[Thî⫠î⫠äñ uñtâ¬rmîñätâ¬d
-lîñk. Añd [http://example.com/ î⫠äñöthâ¬r.
-
-# thî⫠î⫠äñ ördâ¬râ¬d lîâ«t
-# whîch cöñtîñuâ¬â«
-## äñd hä⫠äñöthâ¬r ördâ¬râ¬d lîâ«t
-## ñâ¬â«tâ¬d îñâ«Ã®d⬠ît
-# äñd thâ¬Ã± fällâ« bäck
-#* äñd thâ¬Ã± ñâ¬â«t⫠äñöthâ¬r lîâ«t
-#* thî⫠tîm⬠äñ uñördâ¬râ¬d öñâ¬
-#** îtâ«â¬lf cöñtäîñîñg ä ñâ¬â«tâ¬d lîâ«t
-#** whîch cöñtîñuâ¬â«
-#**# äñd fîñälly ñâ¬â«tâ« yâ¬t äñöthâ¬r ördâ¬râ¬d lîâ«t
-#**# whîch cöñtîñuâ¬â«
-#* dröp⫠bäck quît⬠ä wäy
-# äñd fîñälly äll th⬠wäy
-#****** äñd fîñîâ«hâ¬â« wîth äñ îñvälîd îtâ¬m
-
-=== hâ¬Ã¤dîñg wîth mîâ«â«Ã®Ã±g clöâ«Ã®Ã±g täg
-* lîâ«t
-# ñâ¬w lîâ«t
-SLAB
-
-longer_slab_of_UTF8_text_output = <pärägräph ∫€cöñd lîñ€
-ñ€w pärägräph
-ä h€ädîñg
-
- ä blöckquöt€ ∫€cöñd lîñ€ öf blöckquöt€
- ñ€w pärägräph wîthîñ blöckquöt€
-
-äñöth€r h€ädîñg
-pärägräph wîthîñ multîpl€ ∫tyl€∫ äñd tt ∫päñ
-∫îmîlär, but wîth ∫tyl€∫ îñ dîff€r€ñt örd€r
-ägäîñ, ä dîff€r€ñt örd€r
-
- - lî∫t ît€m 1
-
- - ñ€∫t€d lî∫t ît€m 1
- - ñ€∫t€d lî∫t ît€m 2
- - ñ€∫t€d lî∫t ît€m 3
-
-
- - lî∫t ît€m 2
-
-// thî∫ î∫ ä cöd€ blöck
-ñötîc€ höw ît cäñ cöñtäîñ ''märkup''
-whîch wöuld '''öth€rwî∫€''' häv€ <tt>∫p€cîäl</tt> m€äñîñg
-älthöugh €xplîcît €ñtîtî€∫ &cöpy; är€ pä∫∫€d thröugh uñchäñg€d
-ä ñörmäl pärägräph ägäîñ
-Thî∫ î∫ wh€r€ w€ ∫höw ä lîñk tö äñ ärtîcl€ öñ GCC. R€lät€d tö thät, ä lîñk tö th€ ∫äm€ ärtîcl€ but wîth cu∫töm lîñk t€xt.
-Ext€rñäl lîñk∫ wörk töö. A∫ w€ll ä∫ äutölîñk∫ ä∫ ∫€€ñ http://example.com/ her€.
-Löök ät höw w€ häñdl€ bäd ∫yñtäx. [[Thî∫ î∫ äñ uñt€rmîñät€d lîñk. Añd [http://example.com/ î∫ äñöth€r.
-
- - thî∫ î∫ äñ örd€r€d lî∫t
- - whîch cöñtîñu€∫
-
- - äñd hä∫ äñöth€r örd€r€d lî∫t
- - ñ€∫t€d îñ∫îd€ ît
-
-
- - äñd th€ñ fäll∫ bäck
-
- - äñd th€ñ ñ€∫t∫ äñöth€r lî∫t
- - thî∫ tîm€ äñ uñörd€r€d öñ€
-
- - ît∫€lf cöñtäîñîñg ä ñ€∫t€d lî∫t
- - whîch cöñtîñu€∫
-
- - äñd fîñälly ñ€∫t∫ y€t äñöth€r örd€r€d lî∫t
- - whîch cöñtîñu€∫
-
-
-
-
- - dröp∫ bäck quît€ ä wäy
-
-
- - äñd fîñälly äll th€ wäy
-
- - ***** äñd fîñî∫h€∫ wîth äñ îñvälîd ît€m
-
-
-
-h€ädîñg wîth mî∫∫îñg clö∫îñg täg
-
-
- - ñ€w lî∫t
-
-SLAB
-
-def parse job, description, parser, input
- job.report(description) do
- parser.profiling_parse input
- end
-end
-
-parser = Wikitext::Parser.new
-
-# sanity check
-raise 'mismatch (short slab of ASCII text)' unless (parser.parse(short_slab_of_ASCII_text) == short_slab_of_ASCII_text_output)
-raise 'mismatch (short slab of UTF-8 text)' unless (parser.parse(short_slab_of_UTF8_text) == short_slab_of_UTF8_text_output)
-raise 'mismatch (longer slab of ASCII text)' unless (parser.parse(longer_slab_of_ASCII_text) == longer_slab_of_ASCII_text_output)
-raise 'mismatch (longer slab of UTF-8 text)' unless (parser.parse(longer_slab_of_UTF8_text) == longer_slab_of_UTF8_text_output)
-
-Benchmark.bmbm do |job|
- parse job, 'short slab of ASCII text', parser, short_slab_of_ASCII_text
- parse job, 'short slab of UTF-8 text', parser, short_slab_of_UTF8_text
- parse job, 'longer slab of ASCII text', parser, longer_slab_of_ASCII_text
- parse job, 'longer slab of UTF-8 text', parser, longer_slab_of_UTF8_text
-end
diff --git a/doc/rdoc.rb b/doc/rdoc.rb
index b740575..51cc77a 100644
--- a/doc/rdoc.rb
+++ b/doc/rdoc.rb
@@ -367,18 +367,6 @@ module Wikitext
# See parser.c for the C source code to this method.
end
- # Like the parse method transforms the UTF-8 input +string+ from
- # wikitext markup into HTML, but doesn't return a result. This
- # method is specifically designed for performance profiling so
- # you shouldn't need to call it in practice. It parses the supplied
- # string 100,000 times so as to provide enough sample data to make
- # profiling useful while minimizing the influence of extraneous
- # factors such as set-up code.
- def profiling_parse string
- # This is just a placeholder.
- # See parser.c for the C source code to this method.
- end
-
# Exception raised when an error occurs during parsing.
# As the parser is designed to gracefully cope with bad syntax, the
# only reason you should see this exception is if you pass
diff --git a/ext/wikitext/parser.c b/ext/wikitext/parser.c
index 283ea5e..c2c6555 100644
--- a/ext/wikitext/parser.c
+++ b/ext/wikitext/parser.c
@@ -1,4 +1,4 @@
-// Copyright 2007-2013 Wincent Colaiuta. All rights reserved.
+// Copyright 2007-2014 Wincent Colaiuta. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
@@ -1051,13 +1051,6 @@ VALUE Wikitext_parser_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-VALUE Wikitext_parser_profiling_parse(VALUE self, VALUE string)
-{
- for (int i = 0; i < 100000; i++)
- Wikitext_parser_parse(1, &string, self);
- return Qnil;
-}
-
// convert a Ruby object (:xml, :html etc) into an int output style
int Wikitext_output_style(VALUE output)
{
diff --git a/ext/wikitext/parser.h b/ext/wikitext/parser.h
index f0c334a..ecf7184 100644
--- a/ext/wikitext/parser.h
+++ b/ext/wikitext/parser.h
@@ -1,4 +1,4 @@
-// Copyright 2008-2009 Wincent Colaiuta. All rights reserved.
+// Copyright 2008-2014 Wincent Colaiuta. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
@@ -36,5 +36,3 @@ VALUE Wikitext_parser_sanitize_link_target(VALUE self, VALUE string);
VALUE Wikitext_parser_encode_link_target(VALUE self, VALUE in);
VALUE Wikitext_parser_parse(int argc, VALUE *argv, VALUE self);
-
-VALUE Wikitext_parser_profiling_parse(VALUE self, VALUE string);
diff --git a/ext/wikitext/wikitext.c b/ext/wikitext/wikitext.c
index 532db50..404fac2 100644
--- a/ext/wikitext/wikitext.c
+++ b/ext/wikitext/wikitext.c
@@ -1,4 +1,4 @@
-// Copyright 2008-2013 Wincent Colaiuta. All rights reserved.
+// Copyright 2008-2014 Wincent Colaiuta. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
@@ -68,7 +68,6 @@ void Init_wikitext()
cWikitextParser = rb_define_class_under(mWikitext, "Parser", rb_cObject);
rb_define_method(cWikitextParser, "initialize", Wikitext_parser_initialize, -1);
rb_define_method(cWikitextParser, "parse", Wikitext_parser_parse, -1);
- rb_define_method(cWikitextParser, "profiling_parse", Wikitext_parser_profiling_parse, 1);
rb_define_method(cWikitextParser, "tokenize", Wikitext_parser_tokenize, 1);
rb_define_method(cWikitextParser, "benchmarking_tokenize", Wikitext_parser_benchmarking_tokenize, 1);
rb_define_method(cWikitextParser, "fulltext_tokenize", Wikitext_parser_fulltext_tokenize, -1);
--
2.40.1