[quote author=avk link=topic=57934.msg432772#msg432772 date=1643558182]
sc_StrToQWord, score: 130
rejected: 30000000
[/quote]
Я изначально не стремился обрабатывать дополнительные символы, кроме ведущих для чисел. Моя библиотека принимает именно числа. А не входящую билеберду. Извиняюсь!
Именно по этой причине, вы видите лишь "ошибки". Если я вам в числа залью буквы, вы так же эти ошибки увидите в своих функциях.
Всю билеберду, можно убрать до вызова. Это не займёт много времени исполнения, а при работе с числами, пользователь как раз обрабатывает символы для чисел. И при правильной программе, не будет ни каких посторонних символов. Кроме ведущих нулей, и выделения системы счисления. Я изначально рассчитывал именно на скорость. Но не думал что настолько получу ускорение.
google translate:
I didn't initially aim to handle additional characters other than leading ones for numbers. My library accepts exactly numbers. And not the incoming billebird. I'm sorry!
It is for this reason that you only see "errors". If I put letters in numbers for you, you will also see these errors in your functions.
All billeberd can be removed before the call. This will not take much execution time, and when working with numbers, the user is just processing the characters for numbers. And with the right program, there will be no extraneous characters. In addition to leading zeros, and the selection of the number system. I originally counted on the speed. But I did not think that I would get such an acceleration.
So I still don't understand what you mean.
Когда я писал, у вас была выложена только функция
function TryDecimals2Int(const a: array of char; out aValue: LongWord): Boolean; без String! Я обрадовался когда увидел, что ваша функция обошла мою по скорости! Но позже, я её переписал для String и вся скорость потерялась на этом этапе.
После этого я переписал свою под массив PChar. И увидел в чём реальное ускорение было. А ускорение было не в функции, а в том, чтоб не использовать String в функции.
Вероятно потому вы и не понимаете о чём я пишу. Функций
function TryDecStr2Int(const s: string; out aValue: LongWord): Boolean; у вас тогда ещё не было.
google translate:
When I wrote, you only had
function TryDecimals2Int(const a: array of char; out aValue: LongWord): Boolean; without String! I was delighted when I saw that your function bypassed mine in speed! But later, I rewrote it for String and all the speed was lost at this stage.
After that, I rewrote mine under the PChar array. And I saw what the real acceleration was. And the acceleration was not in the function, but in not using String in the function.
That's probably why you don't understand what I'm talking about. Functions
function TryDecStr2Int(const s: string; out aValue: LongWord): Boolean; you did not yet have.
Но у меня возникает вопрос, а почему в вашем коде не идёт ускорение при использовании массива PChar? Функция
TryChars2Int(a[1..Length(a)], v) работает явно быстрее. На каком моменте в коде начинает проявляться перевод String в массив PChar?
TryChars2Int(a[1..Length(a)], v) работает в два раза быстрее чем
TryStr2Int(a, v). Почему в вашем коде это не работает быстрее?
google translate:
But I have a question, why is there no acceleration in your code when using the PChar array? The function
TryChars2Int(a[1..Length(a)], v) is clearly faster. At what point in the code does the translation of String into a PChar array begin to appear?
TryChars2Int(a[1..Length(a)], v) is twice as fast as
TryStr2Int(a, v) . Why doesn't it work faster in your code?