Search found 591 matches

by Oso
Sun Dec 31, 2023 7:59 pm
Forum: Tricks 'n' Tips
Topic: Fast functions for numeric string value test
Replies: 4
Views: 646

Re: Fast functions for numeric string value test

Hi, 1. "-.1" is not number !? 2. "1e3" is number 3. Use Case '0' to '9' for better read code A Boolean should not be defined as a byte. More ASM code is sometimes created. I wrote them to precisely match an existing end-user's commercial application that I'm replacing, so I'm co...
by Oso
Sun Dec 31, 2023 1:06 pm
Forum: Tricks 'n' Tips
Topic: Fast functions for numeric string value test
Replies: 4
Views: 646

Fast functions for numeric string value test

Inspired by @highend's ongoing quest for the fastest possible extraction of trailing numbers from a string, https://www.purebasic.fr/english/viewtopic.php?p=613654#p613654 I thought I'd use the opportunity to develop the code into numeric test functions. I seem to recall the question has been raised...
by Oso
Sat Dec 30, 2023 5:23 pm
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

mk-soft wrote: Sat Dec 30, 2023 5:09 pm Optimation 8 with static string buffer

Update
Definitely simpler. Is there an advantage to Threaded, over Global? They seem to be the same in performance, difficult to tell exactly, because each test varies. The allocated memory is the fastest, I'm getting < 10ms for that.
by Oso
Sat Dec 30, 2023 4:42 pm
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

This reduces the time down to around 15 - 20ms for me, sometimes completes in less than that. It's necessary to allocate some memory and pass the pointer to that, as workspace. This reduces the work, since there is no string handling before the final result.s. :D OpenConsole() EnableExplicit Procedu...
by Oso
Sat Dec 30, 2023 12:28 pm
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

Result (function 1): 6481 [92.197 ms] Result (function 2): 6481 [106.495 ms] Result (function 3): 6481 [133.019 ms] Result (function 4): 6481 [42.623 ms] Result (function 5): 6481 [45.636 ms] Very useful to see these comparisons. I'm surprised at the disparity in time between (3) and (4/5) because ...
by Oso
Sat Dec 30, 2023 11:17 am
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

And with due regard for Marc56us's nifty ReverseString(), do that also. It might be quicker, because we wouldn't be shuffling the string each time. result + Chr(*LastPtr\c) ; Add the character . . . ProcedureReturn ReverseString(result) ; Reverse the output
by Oso
Sat Dec 30, 2023 11:00 am
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

But if you really do want to count in reverse, Highend (and because it makes me feel like a grown-up, using pointers... :lol: ) you could do it like this. Maybe there's a quicker way I haven't thought of. Since you're reversing back, you need to prefix 'result' with each character, instead of append...
by Oso
Sat Dec 30, 2023 10:51 am
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

I've got a big secret: the F1 key :mrgreen: I've read (and reread) ALL the help functions (out of curiosity, and tested all examples) except the 3D functions, which I don't use. :wink: Ah, I had a feeling there might be something wrong with my keyboard :D https://i.ibb.co/KbFK21b/f1.jpg
by Oso
Sat Dec 30, 2023 10:28 am
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

Marc56us wrote: Sat Dec 30, 2023 9:54 am demoText = ReverseString(demoText)
Well, that's one I hadn't seen before, Marc56us :o
by Oso
Sat Dec 30, 2023 9:51 am
Forum: Coding Questions
Topic: Get only trailing numbers from a string?
Replies: 30
Views: 1373

Re: Get only trailing numbers from a string?

Hello Highend, you could just add two lines for a non-numeric check and reset the output, as below. If you want to count in reverse, you would still need to find the trailing zero byte, in order to first know the point at which to begin in reverse. I think therefore it makes more sense to avoid doin...
by Oso
Wed Dec 27, 2023 5:24 pm
Forum: General Discussion
Topic: [SOLVED] Integer calc. variation between ASM and C backend
Replies: 4
Views: 555

Re: Integer calc. variation between ASM and C backend

Little John wrote: Wed Dec 27, 2023 5:02 pm I strongly recommend not to use implicit typecasting, but to use Int(), IntQ() or Round().
Thanks Little John, that answers it for me — now using Round() with #PB_Round_Nearest. Job done :D
by Oso
Wed Dec 27, 2023 4:48 pm
Forum: General Discussion
Topic: [SOLVED] Integer calc. variation between ASM and C backend
Replies: 4
Views: 555

[SOLVED] Integer calc. variation between ASM and C backend

Can anyone help to explain the reason behind this variation between ASM and C please? I'm using PB 6.00, Windows x64. I have been converting some Julian-day-count routines, which were written in C, into PureBasic. When I found that I was unable to obtain the precise result, due to a rounding variati...
by Oso
Sun Dec 24, 2023 10:09 pm
Forum: Coding Questions
Topic: Prefilling a List
Replies: 15
Views: 1362

Re: Prefilling a List

I often tend to favour the use of maps rather than lists, partly because they are so much easier to populate, with a single statement, but I also find them easier to manage. I've always found lists to be a bit arcane. But it depends on performance considerations and the below may not suit everyone —...
by Oso
Sun Dec 24, 2023 9:09 pm
Forum: Off Topic
Topic: Merry Xmas
Replies: 11
Views: 1760

Re: Merry Xmas

Olli wrote: Sun Dec 24, 2023 6:40 pm --> Nice day to Oso !
Thank you Olli, joyeux Noël à toi, Meilleurs Voeux... ton anglais est bon :D
by Oso
Sun Dec 24, 2023 3:08 pm
Forum: Off Topic
Topic: Merry Xmas
Replies: 11
Views: 1760

Re: Merry Xmas

Thank you GeoTrail, wish you a very happy xmas likewise. Congratulations on your 20 years on the forum.