C++ Output Implementations // Are there ways to perform faster ?

Правка en27, от SPyofgame, 2020-03-09 17:08:00

Here are some implementations to output numbers I found

Time to write first 10.000.000 non-negative numbers (base on Codeforces Custom Test // GNU G++ 17 7.3.0)

Putchar Non-recursive Dividing Implementation: 3649ms
Putchar Recursive Implementation: 3510ms
Putchar Reverse Implementation: 3462ms
Putchar Non-recursive toString Implementation: 3369ms
Printf Implementation: 1762ms
synchronized(off) Cout Implementation: 1356ms
synchronized(off) Cout Implementation: 1060ms
Normal Cout Implementation: 1045ms
fwrite buffer Implementation: 545ms

Time to write 1.000 times first 10000 numbers (base on [Codeforces Custom Test](https://mirror.codeforces.com/problemset/customtest) // GNU G++ 17 7.3.0)

Putchar Reverse Implementation: 1981ms
Putchar Non-recursive Dividing Implementation: 1980ms
Putchar Non-recursive toString Implementation: 1934ms
Putchar Recursive Implementation: 1887ms
Printf Implementation: 1216ms
synchronized(on) Implementation: 873ms
Normal Cout Implementation: 873ms
synchronized(off) Cout Implementation: 857ms
fwrite buffer Implementation: 311ms

Time to write first 10.000.000 non-positive numbers (base on Codeforces Custom Test // GNU G++ 17 7.3.0)

Putchar Non-recursive toString Implementation: 3946ms
Putchar Reverse Implementation: 3930ms
Putchar Recursive Implementation: 3915ms
Putchar Non-recursive Dividing Implementation: 3883ms
Printf Implementation: 1808ms
synchronized(off) Cout Implementation: 1481ms
synchronized(off) Cout Implementation: 1092ms
Normal Cout Implementation: 1092ms
fwrite buffer Implementation: 561ms

Single Line Template

Putchar Non-recursive toString Implementation
Putchar Reverse Implementation
Putchar Recursive Implementation
Putchar Non-recursive Dividing Implementation
Printf Implementation
synchronized(off) Cout Implementation
synchronized(off) Cout Implementation
Cout Implementation
fwrite buffer Implementation

---------- About: ----------

---------- Planning: ----------

  • Test about random 10.000.000 big numbers
  • Test with GNU G++ 14 6.4.0
  • Test with GNU G++ 11 5.1.0
  • More implementations (Actually the post is about Faster and Faster Short Output Implementation but I will add some for speed comparing)
  • New type of implementations (long long, double, string)
Теги #c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en44 Английский SPyofgame 2020-06-06 17:24:10 2 Tiny change: '\n\n\n\n\n' -> '\n\n\n\n\n\n'
en43 Английский SPyofgame 2020-06-01 04:54:23 24664 Add Sort by Microsoft Visual C++ 2010 | Add Sort by Microsoft Visual C++ 2017
en42 Английский SPyofgame 2020-03-11 17:17:22 246
en41 Английский SPyofgame 2020-03-11 17:16:30 585
en40 Английский SPyofgame 2020-03-11 17:07:19 1028
en39 Английский SPyofgame 2020-03-11 16:19:02 5 Tiny change: '\n- _[C++ Output Implem' -> '\n- _[C++ Input Implem'
en38 Английский SPyofgame 2020-03-11 16:17:54 828
en37 Английский SPyofgame 2020-03-11 16:00:33 163
en36 Английский SPyofgame 2020-03-11 15:32:22 3
en35 Английский SPyofgame 2020-03-11 13:43:24 46 Tiny change: '-- \n\n- _Test ' -> '-- \n\n- _Start working on `Input Implementation`_\n- _Test '
en34 Английский SPyofgame 2020-03-11 12:13:31 13359
en33 Английский SPyofgame 2020-03-10 17:02:27 66
en32 Английский SPyofgame 2020-03-10 16:57:31 2020
en31 Английский SPyofgame 2020-03-10 16:45:15 17395
en30 Английский SPyofgame 2020-03-10 15:13:24 436
en29 Английский SPyofgame 2020-03-10 15:04:53 11184
en28 Английский SPyofgame 2020-03-09 17:08:42 23 Tiny change: '_\n- _New type of implementations (long lo' -> '_\n- _New output types (long lo'
en27 Английский SPyofgame 2020-03-09 17:08:00 107
en26 Английский SPyofgame 2020-03-09 17:04:42 56
en25 Английский SPyofgame 2020-03-09 17:02:11 259 Tiny change: ' 14 6.4.0`_\n- _Test' -> ' 14 6.4.0` for who_\n- _Test'
en24 Английский SPyofgame 2020-03-08 14:31:46 1 Tiny change: 'ementation to output' -> 'ementations to output'
en23 Английский SPyofgame 2020-03-08 13:35:10 56
en22 Английский SPyofgame 2020-03-08 13:34:24 62
en21 Английский SPyofgame 2020-03-08 13:32:27 151
en20 Английский SPyofgame 2020-03-08 13:31:05 22
en19 Английский SPyofgame 2020-03-08 13:30:04 643
en18 Английский SPyofgame 2020-03-08 13:23:01 2 Tiny change: 't[buf_len]. buf_num[b' -> 't[buf_len], buf_num[b'
en17 Английский SPyofgame 2020-03-08 13:21:59 2393
en16 Английский SPyofgame 2020-03-08 06:24:35 1405
en15 Английский SPyofgame 2020-03-08 05:43:13 2610
en14 Английский SPyofgame 2020-03-07 21:43:54 1881
en13 Английский SPyofgame 2020-03-07 21:05:24 16
en12 Английский SPyofgame 2020-03-07 21:00:12 68
en11 Английский SPyofgame 2020-03-07 17:34:09 40
en10 Английский SPyofgame 2020-03-07 13:05:13 3986
en9 Английский SPyofgame 2020-03-07 12:49:33 421
en8 Английский SPyofgame 2020-03-07 12:34:04 128
en7 Английский SPyofgame 2020-03-07 12:32:50 28
en6 Английский SPyofgame 2020-03-07 12:32:25 200
en5 Английский SPyofgame 2020-03-07 12:17:57 217
en4 Английский SPyofgame 2020-03-07 12:16:16 502
en3 Английский SPyofgame 2020-03-07 12:12:35 9
en2 Английский SPyofgame 2020-03-07 12:11:11 16 Tiny change: ' summary="Third Implement' -> ' summary="synchronized(off) Implement'
en1 Английский SPyofgame 2020-03-07 12:10:26 2318 Initial revision (published)