Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CIF-JSON new draft

Marcin, that was Firefox/ Windows 10 / 4-processor i5 laptop.

James, totally aside -- it's not every day someone shows me something in JavaScript I've never heard of! map/let? Wow. I compared your map/let syntax with more common for/parseFloat and it looks like the optimizers maybe do a slightly better job with the simpler for/parseFloat, maybe.

Anyway, just for fun:

Firefox:

245 ms map(parseFloat)(JSON.parse([str,str,str...]))
191 ms map(parseFloat)(JSON.parse([str,str,str...]))
191 ms map(parseFloat)(JSON.parse([str,str,str...]))
188 ms map(parseFloat)(JSON.parse([str,str,str...]))
253 ms map(parseFloat)(JSON.parse([str,str,str...]))
268 ms map(parseFloat)(JSON.parse([str,str,str...]))
189 ms map(parseFloat)(JSON.parse([str,str,str...]))
188 ms map(parseFloat)(JSON.parse([str,str,str...]))
189 ms map(parseFloat)(JSON.parse([str,str,str...]))

164 ms parseFloat(JSON.parse([str,str,str...]))
237 ms parseFloat(JSON.parse([str,str,str...]))
238 ms parseFloat(JSON.parse([str,str,str...]))
159 ms parseFloat(JSON.parse([str,str,str...]))
158 ms parseFloat(JSON.parse([str,str,str...]))
152 ms parseFloat(JSON.parse([str,str,str...]))
159 ms parseFloat(JSON.parse([str,str,str...]))
251 ms parseFloat(JSON.parse([str,str,str...]))
196 ms parseFloat(JSON.parse([str,str,str...]))

182 ms JSON.parse([num,num,num,num])
136 ms JSON.parse([num,num,num,num])
134 ms JSON.parse([num,num,num,num])
132 ms JSON.parse([num,num,num,num])
134 ms JSON.parse([num,num,num,num])
133 ms JSON.parse([num,num,num,num])
130 ms JSON.parse([num,num,num,num])
135 ms JSON.parse([num,num,num,num])
136 ms JSON.parse([num,num,num,num])


Chrome: about half speed of Firefox (in my experience this means it is not utilizing multiple processors); factor of 1.5? difference parseFloat/strings or nums; half speed with map/let/strings

641 ms map(parseFloat)(JSON.parse([str,str,str...]))
588 ms map(parseFloat)(JSON.parse([str,str,str...]))
471 ms map(parseFloat)(JSON.parse([str,str,str...]))
470 ms map(parseFloat)(JSON.parse([str,str,str...]))
511 ms map(parseFloat)(JSON.parse([str,str,str...]))
723 ms map(parseFloat)(JSON.parse([str,str,str...]))
473 ms map(parseFloat)(JSON.parse([str,str,str...]))
485 ms map(parseFloat)(JSON.parse([str,str,str...]))
467 ms map(parseFloat)(JSON.parse([str,str,str...]))

242 ms parseFloat(JSON.parse([str,str,str...]))
398 ms parseFloat(JSON.parse([str,str,str...]))
298 ms parseFloat(JSON.parse([str,str,str...]))
326 ms parseFloat(JSON.parse([str,str,str...]))
320 ms parseFloat(JSON.parse([str,str,str...]))
302 ms parseFloat(JSON.parse([str,str,str...]))
302 ms parseFloat(JSON.parse([str,str,str...]))
673 ms parseFloat(JSON.parse([str,str,str...]))
292 ms parseFloat(JSON.parse([str,str,str...]))

263 ms JSON.parse([num,num,num,num])
247 ms JSON.parse([num,num,num,num])
244 ms JSON.parse([num,num,num,num])
247 ms JSON.parse([num,num,num,num])
244 ms JSON.parse([num,num,num,num])
254 ms JSON.parse([num,num,num,num])
247 ms JSON.parse([num,num,num,num])
245 ms JSON.parse([num,num,num,num])
251 ms JSON.parse([num,num,num,num])

Edge: no difference parseFloat/strings or nums; half speed with map/let/strings

392 ms map(parseFloat)(JSON.parse([str,str,str...]))
279 ms map(parseFloat)(JSON.parse([str,str,str...]))
312 ms map(parseFloat)(JSON.parse([str,str,str...]))
345 ms map(parseFloat)(JSON.parse([str,str,str...]))
329 ms map(parseFloat)(JSON.parse([str,str,str...]))
305 ms map(parseFloat)(JSON.parse([str,str,str...]))
274 ms map(parseFloat)(JSON.parse([str,str,str...]))
320 ms map(parseFloat)(JSON.parse([str,str,str...]))
315 ms map(parseFloat)(JSON.parse([str,str,str...]))

154 ms parseFloat(JSON.parse([str,str,str...]))
171 ms parseFloat(JSON.parse([str,str,str...]))
195 ms parseFloat(JSON.parse([str,str,str...]))
167 ms parseFloat(JSON.parse([str,str,str...]))
189 ms parseFloat(JSON.parse([str,str,str...]))
191 ms parseFloat(JSON.parse([str,str,str...]))
176 ms parseFloat(JSON.parse([str,str,str...]))
189 ms parseFloat(JSON.parse([str,str,str...]))
154 ms parseFloat(JSON.parse([str,str,str...]))

221 ms JSON.parse([num,num,num,num])
155 ms JSON.parse([num,num,num,num])
151 ms JSON.parse([num,num,num,num])
222 ms JSON.parse([num,num,num,num])
153 ms JSON.parse([num,num,num,num])
175 ms JSON.parse([num,num,num,num])
194 ms JSON.parse([num,num,num,num])
184 ms JSON.parse([num,num,num,num])
150 ms JSON.parse([num,num,num,num])


On Tue, May 2, 2017 at 3:24 AM, Marcin Wojdyr <wojdyr@gmail.com> wrote:
Bob: point taken, the difference is not significant here. What browser
was it, just for the record?

James: if you do b.map(parseFloat)
you're creating a second list. That's the main difference with Bob's benchmark.

The simpler solution would be to just write in the spec that CIF
numbers can be represented either as strings or as numbers in JSON.

Marcin
_______________________________________________
cif-developers mailing list
cif-developers@iucr.org
http://mailman.iucr.org/cgi-bin/mailman/listinfo/cif-developers



--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900

_______________________________________________
cif-developers mailing list
cif-developers@iucr.org
http://mailman.iucr.org/cgi-bin/mailman/listinfo/cif-developers

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Council for Science (admitted 1947). Member of CODATA, the ICSU Committee on Data. Member of ICSTI, the International Council for Scientific and Technical Information. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

ICSU Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.