Sample Header Ad - 728x90

Faster way to enumerate number than GNU seq?

1 vote
6 answers
1123 views
I want to enumerate numbers (between 1 to 10136 range) but so far, most tools and trick I tried would struggle after 109 numbers or so... Here some examples (with smaller range): For seq 99999
real    0m0.056s
user    0m0.004s
sys     0m0.051s
For seq 9999999
real    1m5.550s
user    0m0.156s
sys     0m6.615s
So on so forth... Thing is, it start to struggle only after the 9th number or so (in this case, 999999999) and on ward. I thought of splitting them in smaller range and running them in parallel: ` cat 10), it still struggle and seems like it would take forever to complete... I don't need to write the enumerated numbers to a file, but i do need it to be on stdout, so that i can process it. EDIT: @Isaac mentioned in his answer (and in the comment) something that *could* work, and while it does goes through 1010 much faster than anything else mentioned, it still struggle for any range bigger than 1010 (and by extension, 10136). Worth mentioning since it was mentioned as a possible duplicate to this post (which it technically isn't). How do i enumerate from 0 to 10136 faster than GNU seq does?
Asked by Nordine Lotfi (2482 rep)
Jun 15, 2020, 12:21 AM
Last activity: Jun 16, 2020, 01:38 AM