Skip to content

Commit 8b58f93

Browse files
committed
Added a benchmark to test a large diff. The speedtest{1,2}.txt files
are the same ones used by Neil Fraser in his speedtest code.
1 parent 085e8b9 commit 8b58f93

File tree

3 files changed

+442
-1
lines changed

3 files changed

+442
-1
lines changed

diffmatchpatch/dmp_test.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package diffmatchpatch
33
import (
44
"bytes"
55
"fmt"
6+
"io/ioutil"
67
"reflect"
78
"runtime"
89
"strconv"
@@ -1340,7 +1341,7 @@ func Benchmark_DiffMain(bench *testing.B) {
13401341
a = a + a
13411342
b = b + b
13421343
}
1343-
1344+
bench.ResetTimer()
13441345
for i := 0; i < bench.N; i++ {
13451346
dmp.DiffMain(a, b, true)
13461347
}
@@ -1361,3 +1362,25 @@ func Benchmark_DiffCommonSuffix(b *testing.B) {
13611362
dmp.DiffCommonSuffix(a, a)
13621363
}
13631364
}
1365+
1366+
func Benchmark_DiffMainLarge(b *testing.B) {
1367+
bytes1, err := ioutil.ReadFile("speedtest1.txt")
1368+
if err != nil {
1369+
b.Fatal(err)
1370+
}
1371+
bytes2, err := ioutil.ReadFile("speedtest2.txt")
1372+
if err != nil {
1373+
b.Fatal(err)
1374+
}
1375+
s1 := string(bytes1)
1376+
s2 := string(bytes2)
1377+
dmp := New()
1378+
b.ResetTimer()
1379+
for i := 0; i < b.N; i++ {
1380+
dmp.DiffMain(s1, s2, true)
1381+
}
1382+
}
1383+
1384+
1385+
1386+

diffmatchpatch/speedtest1.txt

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
This is a '''list of newspapers published by [[Journal Register Company]]'''.
2+
3+
The company owns daily and weekly newspapers, other print media properties and newspaper-affiliated local Websites in the [[U.S.]] states of [[Connecticut]], [[Michigan]], [[New York]], [[Ohio]] and [[Pennsylvania]], organized in six geographic "clusters":<ref>[http://www.journalregister.com/newspapers.html Journal Register Company: Our Newspapers], accessed February 10, 2008.</ref>
4+
5+
== Capital-Saratoga ==
6+
Three dailies, associated weeklies and [[pennysaver]]s in greater [[Albany, New York]]; also [http://www.capitalcentral.com capitalcentral.com] and [http://www.jobsinnewyork.com JobsInNewYork.com].
7+
8+
* ''The Oneida Daily Dispatch'' {{WS|oneidadispatch.com}} of [[Oneida, New York]]
9+
* ''[[The Record (Troy)|The Record]]'' {{WS|troyrecord.com}} of [[Troy, New York]]
10+
* ''[[The Saratogian]]'' {{WS|saratogian.com}} of [[Saratoga Springs, New York]]
11+
* Weeklies:
12+
** ''Community News'' {{WS|cnweekly.com}} weekly of [[Clifton Park, New York]]
13+
** ''Rome Observer'' of [[Rome, New York]]
14+
** ''Life & Times of Utica'' of [[Utica, New York]]
15+
16+
== Connecticut ==
17+
Five dailies, associated weeklies and [[pennysaver]]s in the state of [[Connecticut]]; also [http://www.ctcentral.com CTcentral.com], [http://www.ctcarsandtrucks.com CTCarsAndTrucks.com] and [http://www.jobsinct.com JobsInCT.com].
18+
19+
* ''The Middletown Press'' {{WS|middletownpress.com}} of [[Middletown, Connecticut|Middletown]]
20+
* ''[[New Haven Register]]'' {{WS|newhavenregister.com}} of [[New Haven, Connecticut|New Haven]]
21+
* ''The Register Citizen'' {{WS|registercitizen.com}} of [[Torrington, Connecticut|Torrington]]
22+
23+
* [[New Haven Register#Competitors|Elm City Newspapers]] {{WS|ctcentral.com}}
24+
** ''The Advertiser'' of [[East Haven, Connecticut|East Haven]]
25+
** ''Hamden Chronicle'' of [[Hamden, Connecticut|Hamden]]
26+
** ''Milford Weekly'' of [[Milford, Connecticut|Milford]]
27+
** ''The Orange Bulletin'' of [[Orange, Connecticut|Orange]]
28+
** ''The Post'' of [[North Haven, Connecticut|North Haven]]
29+
** ''Shelton Weekly'' of [[Shelton, Connecticut|Shelton]]
30+
** ''The Stratford Bard'' of [[Stratford, Connecticut|Stratford]]
31+
** ''Wallingford Voice'' of [[Wallingford, Connecticut|Wallingford]]
32+
** ''West Haven News'' of [[West Haven, Connecticut|West Haven]]
33+
* Housatonic Publications
34+
** ''The New Milford Times'' {{WS|newmilfordtimes.com}} of [[New Milford, Connecticut|New Milford]]
35+
** ''The Brookfield Journal'' of [[Brookfield, Connecticut|Brookfield]]
36+
** ''The Kent Good Times Dispatch'' of [[Kent, Connecticut|Kent]]
37+
** ''The Bethel Beacon'' of [[Bethel, Connecticut|Bethel]]
38+
** ''The Litchfield Enquirer'' of [[Litchfield, Connecticut|Litchfield]]
39+
** ''Litchfield County Times'' of [[Litchfield, Connecticut|Litchfield]]
40+
* Imprint Newspapers {{WS|imprintnewspapers.com}}
41+
** ''West Hartford News'' of [[West Hartford, Connecticut|West Hartford]]
42+
** ''Windsor Journal'' of [[Windsor, Connecticut|Windsor]]
43+
** ''Windsor Locks Journal'' of [[Windsor Locks, Connecticut|Windsor Locks]]
44+
** ''Avon Post'' of [[Avon, Connecticut|Avon]]
45+
** ''Farmington Post'' of [[Farmington, Connecticut|Farmington]]
46+
** ''Simsbury Post'' of [[Simsbury, Connecticut|Simsbury]]
47+
** ''Tri-Town Post'' of [[Burlington, Connecticut|Burlington]], [[Canton, Connecticut|Canton]] and [[Harwinton, Connecticut|Harwinton]]
48+
* Minuteman Publications
49+
** ''[[Fairfield Minuteman]]'' of [[Fairfield, Connecticut|Fairfield]]
50+
** ''The Westport Minuteman'' {{WS|westportminuteman.com}} of [[Westport, Connecticut|Westport]]
51+
* Shoreline Newspapers weeklies:
52+
** ''Branford Review'' of [[Branford, Connecticut|Branford]]
53+
** ''Clinton Recorder'' of [[Clinton, Connecticut|Clinton]]
54+
** ''The Dolphin'' of [[Naval Submarine Base New London]] in [[New London, Connecticut|New London]]
55+
** ''Main Street News'' {{WS|ctmainstreetnews.com}} of [[Essex, Connecticut|Essex]]
56+
** ''Pictorial Gazette'' of [[Old Saybrook, Connecticut|Old Saybrook]]
57+
** ''Regional Express'' of [[Colchester, Connecticut|Colchester]]
58+
** ''Regional Standard'' of [[Colchester, Connecticut|Colchester]]
59+
** ''Shoreline Times'' {{WS|shorelinetimes.com}} of [[Guilford, Connecticut|Guilford]]
60+
** ''Shore View East'' of [[Madison, Connecticut|Madison]]
61+
** ''Shore View West'' of [[Guilford, Connecticut|Guilford]]
62+
* Other weeklies:
63+
** ''Registro'' {{WS|registroct.com}} of [[New Haven, Connecticut|New Haven]]
64+
** ''Thomaston Express'' {{WS|thomastownexpress.com}} of [[Thomaston, Connecticut|Thomaston]]
65+
** ''Foothills Traders'' {{WS|foothillstrader.com}} of Torrington, Bristol, Canton
66+
67+
== Michigan ==
68+
Four dailies, associated weeklies and [[pennysaver]]s in the state of [[Michigan]]; also [http://www.micentralhomes.com MIcentralhomes.com] and [http://www.micentralautos.com MIcentralautos.com]
69+
* ''[[Oakland Press]]'' {{WS|theoaklandpress.com}} of [[Oakland, Michigan|Oakland]]
70+
* ''Daily Tribune'' {{WS|dailytribune.com}} of [[Royal Oak, Michigan|Royal Oak]]
71+
* ''Macomb Daily'' {{WS|macombdaily.com}} of [[Mt. Clemens, Michigan|Mt. Clemens]]
72+
* ''[[Morning Sun]]'' {{WS|themorningsun.com}} of [[Mount Pleasant, Michigan|Mount Pleasant]]
73+
* Heritage Newspapers {{WS|heritage.com}}
74+
** ''Belleville View''
75+
** ''Ile Camera''
76+
** ''Monroe Guardian''
77+
** ''Ypsilanti Courier''
78+
** ''News-Herald''
79+
** ''Press & Guide''
80+
** ''Chelsea Standard & Dexter Leader''
81+
** ''Manchester Enterprise''
82+
** ''Milan News-Leader''
83+
** ''Saline Reporter''
84+
* Independent Newspapers {{WS|sourcenewspapers.com}}
85+
** ''Advisor''
86+
** ''Source''
87+
* Morning Star {{WS|morningstarpublishing.com}}
88+
** ''Alma Reminder''
89+
** ''Alpena Star''
90+
** ''Antrim County News''
91+
** ''Carson City Reminder''
92+
** ''The Leader & Kalkaskian''
93+
** ''Ogemaw/Oscoda County Star''
94+
** ''Petoskey/Charlevoix Star''
95+
** ''Presque Isle Star''
96+
** ''Preview Community Weekly''
97+
** ''Roscommon County Star''
98+
** ''St. Johns Reminder''
99+
** ''Straits Area Star''
100+
** ''The (Edmore) Advertiser''
101+
* Voice Newspapers {{WS|voicenews.com}}
102+
** ''Armada Times''
103+
** ''Bay Voice''
104+
** ''Blue Water Voice''
105+
** ''Downriver Voice''
106+
** ''Macomb Township Voice''
107+
** ''North Macomb Voice''
108+
** ''Weekend Voice''
109+
** ''Suburban Lifestyles'' {{WS|suburbanlifestyles.com}}
110+
111+
== Mid-Hudson ==
112+
One daily, associated magazines in the [[Hudson River Valley]] of [[New York]]; also [http://www.midhudsoncentral.com MidHudsonCentral.com] and [http://www.jobsinnewyork.com JobsInNewYork.com].
113+
114+
* ''[[Daily Freeman]]'' {{WS|dailyfreeman.com}} of [[Kingston, New York]]
115+
116+
== Ohio ==
117+
Two dailies, associated magazines and three shared Websites, all in the state of [[Ohio]]: [http://www.allaroundcleveland.com AllAroundCleveland.com], [http://www.allaroundclevelandcars.com AllAroundClevelandCars.com] and [http://www.allaroundclevelandjobs.com AllAroundClevelandJobs.com].
118+
119+
* ''[[The News-Herald (Ohio)|The News-Herald]]'' {{WS|news-herald.com}} of [[Willoughby, Ohio|Willoughby]]
120+
* ''[[The Morning Journal]]'' {{WS|morningjournal.com}} of [[Lorain, Ohio|Lorain]]
121+
122+
== Philadelphia area ==
123+
Seven dailies and associated weeklies and magazines in [[Pennsylvania]] and [[New Jersey]], and associated Websites: [http://www.allaroundphilly.com AllAroundPhilly.com], [http://www.jobsinnj.com JobsInNJ.com], [http://www.jobsinpa.com JobsInPA.com], and [http://www.phillycarsearch.com PhillyCarSearch.com].
124+
125+
* ''The Daily Local'' {{WS|dailylocal.com}} of [[West Chester, Pennsylvania|West Chester]]
126+
* ''[[Delaware County Daily and Sunday Times]] {{WS|delcotimes.com}} of Primos
127+
* ''[[The Mercury (Pennsylvania)|The Mercury]]'' {{WS|pottstownmercury.com}} of [[Pottstown, Pennsylvania|Pottstown]]
128+
* ''The Phoenix'' {{WS|phoenixvillenews.com}} of [[Phoenixville, Pennsylvania|Phoenixville]]
129+
* ''[[The Reporter (Lansdale)|The Reporter]]'' {{WS|thereporteronline.com}} of [[Lansdale, Pennsylvania|Lansdale]]
130+
* ''The Times Herald'' {{WS|timesherald.com}} of [[Norristown, Pennsylvania|Norristown]]
131+
* ''[[The Trentonian]]'' {{WS|trentonian.com}} of [[Trenton, New Jersey]]
132+
133+
* Weeklies
134+
** ''El Latino Expreso'' of [[Trenton, New Jersey]]
135+
** ''La Voz'' of [[Norristown, Pennsylvania]]
136+
** ''The Village News'' of [[Downingtown, Pennsylvania]]
137+
** ''The Times Record'' of [[Kennett Square, Pennsylvania]]
138+
** ''The Tri-County Record'' {{WS|tricountyrecord.com}} of [[Morgantown, Pennsylvania]]
139+
** ''News of Delaware County'' {{WS|newsofdelawarecounty.com}}of [[Havertown, Pennsylvania]]
140+
** ''Main Line Times'' {{WS|mainlinetimes.com}}of [[Ardmore, Pennsylvania]]
141+
** ''Penny Pincher'' of [[Pottstown, Pennsylvania]]
142+
** ''Town Talk'' {{WS|towntalknews.com}} of [[Ridley, Pennsylvania]]
143+
* Chesapeake Publishing {{WS|pa8newsgroup.com}}
144+
** ''Solanco Sun Ledger'' of [[Quarryville, Pennsylvania]]
145+
** ''Columbia Ledger'' of [[Columbia, Pennsylvania]]
146+
** ''Coatesville Ledger'' of [[Downingtown, Pennsylvania]]
147+
** ''Parkesburg Post Ledger'' of [[Quarryville, Pennsylvania]]
148+
** ''Downingtown Ledger'' of [[Downingtown, Pennsylvania]]
149+
** ''The Kennett Paper'' of [[Kennett Square, Pennsylvania]]
150+
** ''Avon Grove Sun'' of [[West Grove, Pennsylvania]]
151+
** ''Oxford Tribune'' of [[Oxford, Pennsylvania]]
152+
** ''Elizabethtown Chronicle'' of [[Elizabethtown, Pennsylvania]]
153+
** ''Donegal Ledger'' of [[Donegal, Pennsylvania]]
154+
** ''Chadds Ford Post'' of [[Chadds Ford, Pennsylvania]]
155+
** ''The Central Record'' of [[Medford, New Jersey]]
156+
** ''Maple Shade Progress'' of [[Maple Shade, New Jersey]]
157+
* Intercounty Newspapers {{WS|buckslocalnews.com}}
158+
** ''The Review'' of Roxborough, Pennsylvania
159+
** ''The Recorder'' of [[Conshohocken, Pennsylvania]]
160+
** ''The Leader'' of [[Mount Airy, Pennsylvania|Mount Airy]] and West Oak Lake, Pennsylvania
161+
** ''The Pennington Post'' of [[Pennington, New Jersey]]
162+
** ''The Bristol Pilot'' of [[Bristol, Pennsylvania]]
163+
** ''Yardley News'' of [[Yardley, Pennsylvania]]
164+
** ''New Hope Gazette'' of [[New Hope, Pennsylvania]]
165+
** ''Doylestown Patriot'' of [[Doylestown, Pennsylvania]]
166+
** ''Newtown Advance'' of [[Newtown, Pennsylvania]]
167+
** ''The Plain Dealer'' of [[Williamstown, New Jersey]]
168+
** ''News Report'' of [[Sewell, New Jersey]]
169+
** ''Record Breeze'' of [[Berlin, New Jersey]]
170+
** ''Newsweekly'' of [[Moorestown, New Jersey]]
171+
** ''Haddon Herald'' of [[Haddonfield, New Jersey]]
172+
** ''New Egypt Press'' of [[New Egypt, New Jersey]]
173+
** ''Community News'' of [[Pemberton, New Jersey]]
174+
** ''Plymouth Meeting Journal'' of [[Plymouth Meeting, Pennsylvania]]
175+
** ''Lafayette Hill Journal'' of [[Lafayette Hill, Pennsylvania]]
176+
* Montgomery Newspapers {{WS|montgomerynews.com}}
177+
** ''Ambler Gazette'' of [[Ambler, Pennsylvania]]
178+
** ''Central Bucks Life'' of [[Bucks County, Pennsylvania]]
179+
** ''The Colonial'' of [[Plymouth Meeting, Pennsylvania]]
180+
** ''Glenside News'' of [[Glenside, Pennsylvania]]
181+
** ''The Globe'' of [[Lower Moreland Township, Pennsylvania]]
182+
** ''Main Line Life'' of [[Ardmore, Pennsylvania]]
183+
** ''Montgomery Life'' of [[Fort Washington, Pennsylvania]]
184+
** ''North Penn Life'' of [[Lansdale, Pennsylvania]]
185+
** ''Perkasie News Herald'' of [[Perkasie, Pennsylvania]]
186+
** ''Public Spirit'' of [[Hatboro, Pennsylvania]]
187+
** ''Souderton Independent'' of [[Souderton, Pennsylvania]]
188+
** ''Springfield Sun'' of [[Springfield, Pennsylvania]]
189+
** ''Spring-Ford Reporter'' of [[Royersford, Pennsylvania]]
190+
** ''Times Chronicle'' of [[Jenkintown, Pennsylvania]]
191+
** ''Valley Item'' of [[Perkiomenville, Pennsylvania]]
192+
** ''Willow Grove Guide'' of [[Willow Grove, Pennsylvania]]
193+
* News Gleaner Publications (closed December 2008) {{WS|newsgleaner.com}}
194+
** ''Life Newspapers'' of [[Philadelphia, Pennsylvania]]
195+
* Suburban Publications
196+
** ''The Suburban & Wayne Times'' {{WS|waynesuburban.com}} of [[Wayne, Pennsylvania]]
197+
** ''The Suburban Advertiser'' of [[Exton, Pennsylvania]]
198+
** ''The King of Prussia Courier'' of [[King of Prussia, Pennsylvania]]
199+
* Press Newspapers {{WS|countypressonline.com}}
200+
** ''County Press'' of [[Newtown Square, Pennsylvania]]
201+
** ''Garnet Valley Press'' of [[Glen Mills, Pennsylvania]]
202+
** ''Haverford Press'' of [[Newtown Square, Pennsylvania]] (closed January 2009)
203+
** ''Hometown Press'' of [[Glen Mills, Pennsylvania]] (closed January 2009)
204+
** ''Media Press'' of [[Newtown Square, Pennsylvania]] (closed January 2009)
205+
** ''Springfield Press'' of [[Springfield, Pennsylvania]]
206+
* Berks-Mont Newspapers {{WS|berksmontnews.com}}
207+
** ''The Boyertown Area Times'' of [[Boyertown, Pennsylvania]]
208+
** ''The Kutztown Area Patriot'' of [[Kutztown, Pennsylvania]]
209+
** ''The Hamburg Area Item'' of [[Hamburg, Pennsylvania]]
210+
** ''The Southern Berks News'' of [[Exeter Township, Berks County, Pennsylvania]]
211+
** ''The Free Press'' of [[Quakertown, Pennsylvania]]
212+
** ''The Saucon News'' of [[Quakertown, Pennsylvania]]
213+
** ''Westside Weekly'' of [[Reading, Pennsylvania]]
214+
215+
* Magazines
216+
** ''Bucks Co. Town & Country Living''
217+
** ''Chester Co. Town & Country Living''
218+
** ''Montomgery Co. Town & Country Living''
219+
** ''Garden State Town & Country Living''
220+
** ''Montgomery Homes''
221+
** ''Philadelphia Golfer''
222+
** ''Parents Express''
223+
** ''Art Matters''
224+
225+
{{JRC}}
226+
227+
==References==
228+
<references />
229+
230+
[[Category:Journal Register publications|*]]

0 commit comments

Comments
 (0)