News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Very fast hex$ (our hobby is beating the CRT)

Started by jj2007, April 17, 2024, 02:06:33 AM

Previous topic - Next topic

jj2007

Timings please, just for fun. Credits go to qWord :thumbsup:

AMD Athlon Gold 3150U with Radeon Graphics      (SSE4)

5503    cycles for 100 * Masm32 hex$
4298    cycles for 100 * MasmBasic Hex$
352     cycles for 100 * qWord mmx hex$
428     cycles for 100 * qWord xmm hex$
44520   cycles for 100 * CRT hex$

5675    cycles for 100 * Masm32 hex$
4338    cycles for 100 * MasmBasic Hex$
377     cycles for 100 * qWord mmx hex$
431     cycles for 100 * qWord xmm hex$
44424   cycles for 100 * CRT hex$

5499    cycles for 100 * Masm32 hex$
4305    cycles for 100 * MasmBasic Hex$
353     cycles for 100 * qWord mmx hex$
427     cycles for 100 * qWord xmm hex$
44564   cycles for 100 * CRT hex$

5479    cycles for 100 * Masm32 hex$
4320    cycles for 100 * MasmBasic Hex$
352     cycles for 100 * qWord mmx hex$
433     cycles for 100 * qWord xmm hex$
47006   cycles for 100 * CRT hex$

5513    cycles for 100 * Masm32 hex$
4400    cycles for 100 * MasmBasic Hex$
361     cycles for 100 * qWord mmx hex$
429     cycles for 100 * qWord xmm hex$
44405   cycles for 100 * CRT hex$

Averages:
5505    cycles for Masm32 hex$
4321    cycles for MasmBasic Hex$
355     cycles for qWord mmx hex$
429     cycles for qWord xmm hex$
44503   cycles for CRT hex$

16      bytes for Masm32 hex$
12      bytes for MasmBasic Hex$
92      bytes for qWord mmx hex$
124     bytes for qWord xmm hex$
29      bytes for CRT hex$

Masm32 hex$                             1234ABCD
MasmBasic Hex$                          1234ABCD
qWord mmx hex$                          1234ABCD
qWord xmm hex$                          1234ABCD
CRT hex$                                1234ABCD

zedd151

Intel(R) Core(TM)2 Duo CPU    E8400  @ 3.00GHz (SSE4)

4132    cycles for 100 * Masm32 hex$
8482    cycles for 100 * MasmBasic Hex$
797    cycles for 100 * qWord mmx hex$
1017    cycles for 100 * qWord xmm hex$
75531  cycles for 100 * CRT hex$

4105    cycles for 100 * Masm32 hex$
8427    cycles for 100 * MasmBasic Hex$
797    cycles for 100 * qWord mmx hex$
1018    cycles for 100 * qWord xmm hex$
75587  cycles for 100 * CRT hex$

4090    cycles for 100 * Masm32 hex$
8443    cycles for 100 * MasmBasic Hex$
795    cycles for 100 * qWord mmx hex$
1020    cycles for 100 * qWord xmm hex$
75549  cycles for 100 * CRT hex$

4089    cycles for 100 * Masm32 hex$
8482    cycles for 100 * MasmBasic Hex$
801    cycles for 100 * qWord mmx hex$
1017    cycles for 100 * qWord xmm hex$
75745  cycles for 100 * CRT hex$

4262    cycles for 100 * Masm32 hex$
8521    cycles for 100 * MasmBasic Hex$
808    cycles for 100 * qWord mmx hex$
1019    cycles for 100 * qWord xmm hex$
75669  cycles for 100 * CRT hex$

Averages:
4109    cycles for Masm32 hex$
8469    cycles for MasmBasic Hex$
798    cycles for qWord mmx hex$
1018    cycles for qWord xmm hex$
75602  cycles for CRT hex$

16      bytes for Masm32 hex$
12      bytes for MasmBasic Hex$
92      bytes for qWord mmx hex$
124    bytes for qWord xmm hex$
29      bytes for CRT hex$

Masm32 hex$                            1234ABCD
MasmBasic Hex$                          1234ABCD
qWord mmx hex$                          1234ABCD
qWord xmm hex$                          1234ABCD
CRT hex$                                1234ABCD

--- ok ---

QuoteTimings please, just for fun.
Cycle counts??  :wink2:
Ventanas diez es el mejor.  :azn:

jj2007

Thanks, sudoku :thumbsup:

It seems my attempt to port qWord's algo from mmx to xmm failed miserably :sad:

zedd151

Need some more intels, so I can compare others to my computer.
Masm32 beats MasmBasic. No, it can't be.  :joking:
Ventanas diez es el mejor.  :azn:

sinsi

13th Gen Intel(R) Core(TM) i9-13900KF (SSE4)

1041    cycles for 100 * Masm32 hex$
2648    cycles for 100 * MasmBasic Hex$
317     cycles for 100 * qWord mmx hex$
246     cycles for 100 * qWord xmm hex$
18828   cycles for 100 * CRT hex$

1046    cycles for 100 * Masm32 hex$
2578    cycles for 100 * MasmBasic Hex$
314     cycles for 100 * qWord mmx hex$
249     cycles for 100 * qWord xmm hex$
18788   cycles for 100 * CRT hex$

1034    cycles for 100 * Masm32 hex$
2655    cycles for 100 * MasmBasic Hex$
315     cycles for 100 * qWord mmx hex$
248     cycles for 100 * qWord xmm hex$
18821   cycles for 100 * CRT hex$

1035    cycles for 100 * Masm32 hex$
2607    cycles for 100 * MasmBasic Hex$
334     cycles for 100 * qWord mmx hex$
254     cycles for 100 * qWord xmm hex$
18860   cycles for 100 * CRT hex$

1051    cycles for 100 * Masm32 hex$
2629    cycles for 100 * MasmBasic Hex$
321     cycles for 100 * qWord mmx hex$
248     cycles for 100 * qWord xmm hex$
18909   cycles for 100 * CRT hex$

Averages:
1041    cycles for Masm32 hex$
2628    cycles for MasmBasic Hex$
318     cycles for qWord mmx hex$
248     cycles for qWord xmm hex$
18836   cycles for CRT hex$

16      bytes for Masm32 hex$
12      bytes for MasmBasic Hex$
92      bytes for qWord mmx hex$
124     bytes for qWord xmm hex$
29      bytes for CRT hex$

Masm32 hex$                             1234ABCD
MasmBasic Hex$                          1234ABCD
qWord mmx hex$                          1234ABCD
qWord xmm hex$                          1234ABCD
CRT hex$                                1234ABCD
🍺🍺🍺

daydreamer

18900 crt vs 248 xmm ,if all CRT functions are much slower than a library with fast asm function library does that mean a c program using CRT functions  is that much slower compared to asm program using asm library ?
Its 76.20967741935 times faster
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

Quote from: daydreamer on April 17, 2024, 03:25:59 AMdoes that mean a c program using CRT functions  is that much slower compared to asm program using asm library ?

Well, of course it means that that particular CRT function is that much slower compared to the other (assembler) functions. It doesn't necessarily mean that the program as a whole is that much slower. And as I always try to point out, it may not mean anything at all if these functions are only used to display user input or output, instead of in a way which would significantly affect overall program speed (say if one is processing 100,000 numbers in a spreadsheet or something).
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: sudoku on April 17, 2024, 02:21:54 AMMasm32 beats MasmBasic. No, it can't be.  :joking:

You are right - I forgot the fast option :thumbsup:

mov somevar, Hex$(123456789, fast) (DWORDs only)

AMD Athlon Gold 3150U with Radeon Graphics      (SSE4)

Averages:
5528   cycles for Masm32 hex$
275    cycles for MasmBasic Hex$
357    cycles for qWord mmx hex$
433    cycles for qWord xmm hex$
44624  cycles for CRT hex$

zedd151

Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz (SSE4)

4105    cycles for 100 * Masm32 hex$
624     cycles for 100 * MasmBasic Hex$
797     cycles for 100 * qWord mmx hex$
1018    cycles for 100 * qWord xmm hex$
75615   cycles for 100 * CRT hex$

4128    cycles for 100 * Masm32 hex$
603     cycles for 100 * MasmBasic Hex$
801     cycles for 100 * qWord mmx hex$
1036    cycles for 100 * qWord xmm hex$
75388   cycles for 100 * CRT hex$

4114    cycles for 100 * Masm32 hex$
594     cycles for 100 * MasmBasic Hex$
801     cycles for 100 * qWord mmx hex$
1021    cycles for 100 * qWord xmm hex$
75292   cycles for 100 * CRT hex$

4110    cycles for 100 * Masm32 hex$
593     cycles for 100 * MasmBasic Hex$
801     cycles for 100 * qWord mmx hex$
1020    cycles for 100 * qWord xmm hex$
75426   cycles for 100 * CRT hex$

4103    cycles for 100 * Masm32 hex$
594     cycles for 100 * MasmBasic Hex$
798     cycles for 100 * qWord mmx hex$
1021    cycles for 100 * qWord xmm hex$
75507   cycles for 100 * CRT hex$

Averages:
4110    cycles for Masm32 hex$
597     cycles for MasmBasic Hex$
800     cycles for qWord mmx hex$
1021    cycles for qWord xmm hex$
75440   cycles for CRT hex$

16      bytes for Masm32 hex$
16      bytes for MasmBasic Hex$
92      bytes for qWord mmx hex$
124     bytes for qWord xmm hex$
29      bytes for CRT hex$

Masm32 hex$                             1234ABCD
MasmBasic Hex$                          1234ABCD
qWord mmx hex$                          1234ABCD
qWord xmm hex$                          1234ABCD
CRT hex$                                1234ABCD

--- ok ---

Turbo Mode!  :biggrin:
Ventanas diez es el mejor.  :azn:

sinsi

13th Gen Intel(R) Core(TM) i9-13900KF (SSE4)

Averages:
1036    cycles for Masm32 hex$
132     cycles for MasmBasic Hex$
306     cycles for qWord mmx hex$
249     cycles for qWord xmm hex$
18706   cycles for CRT hex$
Showoff
🍺🍺🍺

jj2007

Thanks, folks :thup:

Honestly, I had forgotten the fast option, which was tested in this thread in July 2023 :cool:

Quote from: NoCforMe on April 17, 2024, 06:28:04 AMit may not mean anything at all if these functions are only used to display user input or output

That would indeed be nonsense, but nobody proposed that.

NoCforMe

Quote from: jj2007 on April 17, 2024, 07:43:15 AMThanks, folks :thup:

Honestly, I had forgotten the fast option, which was tested in this thread in July 2023 :cool:

Quote from: NoCforMe on April 17, 2024, 06:28:04 AMit may not mean anything at all if these functions are only used to display user input or output

That would indeed be nonsense, but nobody proposed that.

No, nobody proposed that, but everybody seems to be ignoring that.

I'd be willing to bet that 80-90% of use cases for these (numeric conversion) functions are for displaying or inputting small amounts of user output/input. Can't prove it, of course, but I'm pretty sure.

How many people here are actually writing applications where it does make a difference in speed? Someone somewhere here mentioned spreadsheets, but really, who besides Micro$oft is actually coding a spreadsheet?
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on April 17, 2024, 08:22:48 AMwho besides Micro$oft is actually coding a spreadsheet?

May 28, 2014, 01:53:07 PM: Spreadsheet viewer (nowadays am ultrafast spreadsheet editor)

April 01, 2024, 09:53:55 AM: Obsession with speed

You are missing the point. An application that uses a slow library will be slow because everything it does depends on slow functions. Every sane programmer will avoid using slow functions in an innermost loop, but if the only library he has is as slow as the CRT, then inevitably his applications will be, ehm, a bit slow. And the World of software is full of awfully slow applications. Oh, btw, LibreOffice seems to use a slow library: I once measured its spreadsheet editor Calc's sorting performance against M$ Excel: horrible, over a factor 10 slower (others have done that, too). Which doesn't mean that Excel is fast, of course - my spreadsheet editor sorts column considerably faster than Excel...

QuoteIn addition, when Google Sheet exceeded 20,000 lines, processing took 1.5 seconds, and when it exceeded 50,000 lines, it was found that it waited nearly 5 seconds.

Quoteall three spreadsheet systems, i.e., Excel, Calc, and Google Sheets, require more than 500ms to sort a spreadsheet with 10k, 6k, and 10k rows, respectively

My spreadsheet editor is not perfect, but it sorts a 44,600 rows spreadsheet in about 30 milliseconds. It uses a fast library.

sinsi

OK, real world scenario. You are using an Explorer-like interface and your ListView needs to show file sizes.
Would a function that takes 10 times longer be OK? No worries for a half-screen of files, but 10,000?

Quote from: NoCforMe on April 17, 2024, 08:22:48 AMwho besides Micro$oft is actually coding a spreadsheet?
[rant]I worked as an on-site tech, the number of people who use Excel for everything would astound you (and make you slightly ill). Weekly budgets where they just add a few rows per week until there are thousands of rows, all automatically refreshing themselves every time data is entered. One lady used it to store recipes  :rolleyes: granted there's not much use for numbers there.
Every accountant in every business I've serviced has their own pet spreadsheet, filled with VBA that uses strings for numbers because they are accountants, not programmers.

Because MS made it part of the basic versions of Office, everyone uses and abuses it.
[/rant]


Off topic, but I find it hard to take someone seriously when they use the term Micro$oft.
Makes you sound 14 :biggrin:
🍺🍺🍺

zedd151

[off topic]I'll just sit here and eat my popcorn. [/off topic] :tongue:  :joking:  :rofl:  :badgrin:

To be ON topic, fast enough is fast enough. Always depends on the application of any algo, and how often you need to use it.
Ventanas diez es el mejor.  :azn: