-
Content Count
842 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Vincent Parrett
-
Seems to be back to running slow again.
-
VSoft.Ulid - A Delphi Implementation of ULID for Delphi XE2 or later.
Vincent Parrett posted a topic in I made this
Hi All I created a Delphi implementation of ULID - A Universally Unique Lexicographically Sortable Identifier. ULID's are a better option than GUIDs where sorting is needed 128-bit compatibility with UUID 1.21e+24 unique ULIDs per millisecond Lexicographically sortable! Canonically encoded as a 26 character string, as opposed to the 36 character UUID Uses Crockford's base32 for better efficiency and readability (5 bits per character) Case insensitive No special characters (URL safe) Monotonic sort order (correctly detects and handles the same millisecond) https://github.com/VSoftTechnologies/VSoft.Ulid -
Seems to be happening on and off. These forums are never fast for me - I'm about as far away as I can get from the servers without enduring the ant artic - ping time of 250ms - but pages are taking around 6s to load for the last few days.
-
VSoft.Ulid - A Delphi Implementation of ULID for Delphi XE2 or later.
Vincent Parrett replied to Vincent Parrett's topic in I made this
I have no idea how to do that. Happy to take a pull request to implement this. FWIW My UUID v7 library does expose the UTCTimestamp. It uses a v54 UUID under the hood to create the random part - which on windows uses the windows cng crypto library. Other than a quick n dirty test application, no. -
ISuperObject decimal issue with currency values
Vincent Parrett replied to Davide Angeli's topic in Delphi Third-Party
What is FloatFormat set to? -
Hi All I have released a new YAML Parser/Emitter library for Delphi XE2 or later. It is pure delphi code, tested with Win32 and Win64 but it should work for other platforms too (no winapi dependencies). Supports YAML 1.1 (partially) & 1.2 JSONPath queries with filter expressions Multiple Document streams. https://github.com/VSoftTechnologies/VSoft.YAML
-
New YAML Parser Library - VSoft.YAML
Vincent Parrett replied to Vincent Parrett's topic in I made this
Lol absolutelty not! XML is a very different beast - adapting the library to json was relatively easy - xml is completely different and would make the code a mess. It wouldn't be too hard to write an xml -> json/yaml converter but it's not something I have a need for and my time is already oversubscribed! FWIW, I have written an xml parser before in the late 90's before msxml was released - was going to make it a commercial product but Ms stole my thunder making msxml free. My parser was faster but used more memory and a different syntax to xpath (xpath wasn't really a thing then). Sadly I can no longer find the source code - I probably wouldn't like the code anyway - I've learned a thing or two about coding and lexers/parsers in general. -
ISuperObject decimal issue with currency values
Vincent Parrett replied to Davide Angeli's topic in Delphi Third-Party
In my experience this will be due to Locale differences - does superobject use FormatSettings at all? -
Added a pull request with VSoft.YAML as a git submodule
-
New YAML Parser Library - VSoft.YAML
Vincent Parrett replied to Vincent Parrett's topic in I made this
FWIW, I pushed some changes today that dramatically improve the peformance ( 3-5x faster parsing, 10x faster writing!) There are also new JSONMode parser option which enables parsing more json files, such as ones that use tabs instead of spaces (tabs are not allowed in json). JSONMode is also more strict when it comes to numbers - json does not allow hex/octal/binary number representations that YAML allows. -
I couldn't help myself - I'm never going to get it as fast as some of the other libraries - those that use records and/or load the entire file into memory before parsing (quit a few libs it turns out) are always going to be faster. That said, I made some decent improvements today. Speed Statistics for System.JSON Average of 5 repetitions (in ms) Generate: 12.60 Save : 6.20 Clear : 9.40 Load : 19.00 Find : 56.20 Parse : 31.20 Total : 159.40 Speed Statistics for VSoft.YAML Average of 5 repetitions (in ms) Generate: 15.20 Save : 31.40 Clear : 12.60 Load : 56.60 Find : 6.20 Parse : 68.60 Total : 209.20 This test app is useful as a guide.. but it does very limited testing with very simple scenarios (apart from the validation tests). It would be a lot of work to make it more comprehensive, there are actually quite a few json libraries for delphi (a good thing imho).
-
Absolutely correct. In particular, file loading/saving, handling. System.JSON has no Load from file or Stream as far as I can tell - so you are loading the entire file in memory. I have questions over encoding handling with some of the others too. The Parse test needs to be split up (its really "to json string -> parse json string"). I made some performance improvements to VSoft.YAML - but the IO side of things needs more work - I have no idea why it's so slow (it uses buffers).
-
This is interesting, I tried it with VSoft.YAML - whilst it can parse JSON, there are some differences in what json and yaml permit. YAML doesn't allow tabs, so it failed the load file test. I ended up adding a JSONMode to the parser options and made some changes to handle some differences between json and yaml. [ 0/ 0]: Starting test [ 0/ 0]: Test : Validation [ 0/ 0]: Library: VSoft.YAML [ 0/ 0]: [ 0/ 0]: FAIL = fail01.json = \x is not a valid escape character = [Exception] = Invalid escape sequence in JSON: \x is not supported at line 1, column 30 [ 0/ 0]: FAIL = fail02.json = Objects require colon between name/value = [Exception] = Expected Colon but got Value at line 1, column 18 [ 0/ 0]: FAIL = fail03.json = Objects do not have comma separators = [Exception] = Expected Colon but got Comma at line 1, column 26 [ 0/ 0]: FAIL = fail04.json = Arrays don't have colon separators = [Exception] = Invalid syntax: object key-value pairs are not allowed in JSON arrays at line 1, column 2 [ 0/ 0]: FAIL = fail05.json = Truth is not a valid boolean value = [Exception] = Invalid literal value in JSON: "truth". JSON only supports true, false, null, numbers, and quoted strings. at line 1, column 20 [ 0/ 0]: FAIL = fail06.json = Strings need double quotes, not single quotes = [Exception] = Single-quoted strings are not valid in JSON at line 1, column 2 [ 0/ 0]: FAIL = fail07.json = Line break in a string value is not valid = [Exception] = Literal line breaks are not allowed in JSON strings. Use \n for newlines. at line 1, column 7 [ 0/ 0]: FAIL = fail08.json = Escaped line break char is still not valid = [Exception] = Line continuation (backslash followed by newline) is not valid in JSON at line 1, column 7 [ 0/ 0]: FAIL = fail09.json = Unclosed array = [Exception] = Unexpected end of file in flow sequence (missing "]") at line 1, column 18 [ 0/ 0]: FAIL = fail10.json = Numbers require exponent if 'e' is there = [Exception] = Invalid number format in JSON: exponent must have at least one digit after e/E at line 1, column 4 [ 0/ 0]: FAIL = fail11.json = Only 1 sign char can precede the value = [Exception] = Invalid number format in JSON: exponent must have at least one digit after e/E at line 1, column 5 [ 0/ 0]: FAIL = fail12.json = Commas cannot close objects = [Exception] = Unexpected end of file in flow mapping (expected key) at line 1, column 41 [ 16/ 16]: FAIL = fail13.json = Brackets must be matching = [Exception] = Expected "," or "]" in flow sequence at line 1, column 12 [ 16/ 0]: FAIL = fail14.json = Double quotes must be escaped = [Exception] = Expected "," or "]" in flow sequence at line 1, column 18 [ 16/ 0]: FAIL = fail15.json = Key string must be quoted = [Exception] = Object keys must be quoted strings in JSON at line 1, column 2 [ 16/ 0]: FAIL = fail16.json = Arrays must not have comma after last value = [Exception] = Missing array element: trailing comma is not allowed in JSON at line 1, column 16 [ 16/ 0]: FAIL = fail17.json = Arrays must have values between commas = [Exception] = Missing array element: array cannot start with comma in JSON at line 1, column 5 [ 16/ 0]: FAIL = fail18.json = Nothing but whitespace can follow the root value = [Exception] = Unexpected comma after closing bracket at line 1, column 26 [ 16/ 0]: FAIL = fail19.json = Each opening bracket must be closed = [Exception] = Unexpected closing bracket "]" - no matching opening bracket at line 1, column 16 [ 32/ 16]: FAIL = fail20.json = Extra comma after object = [Exception] = Expected key in flow mapping at line 1, column 22 [ 32/ 0]: FAIL = fail21.json = Numbers cannot have leading 0s = [Exception] = Numbers with leading zeros are not valid in JSON at line 1, column 41 [ 32/ 0]: FAIL = fail22.json = Numbers can't be hex encoded = [Exception] = Hexadecimal numbers are not valid in JSON at line 1, column 28 [ 32/ 0]: FAIL = fail23.json = Decimal numbers need a digit before the dot = [Exception] = Decimal numbers must have a leading digit before the dot in JSON at line 1, column 1 [ 32/ 0]: PASS = pass01.json = General large array testing valid values [ 32/ 0]: PASS = pass02.json = Heavily nested array [ 32/ 0]: PASS = pass03.json = Nested object [ 32/ 0]: PASS = pass04.json = Simple string value [ 47/ 15]: PASS = pass05.json = Unicode character string [ 47/ 0]: PASS = pass06.json = From https://json.org/example.html [ 47/ 0]: Test finished Whilst VSoft.YAML will not win any races with performance (that was never my focus, adherence to the specs was) - it doesn't do badly. [ 781/ 0]: Speed Statistics for System.JSON [ 781/ 0]: Average of 5 repetitions (in ms) [ 781/ 0]: Generate: 6.40 [ 781/ 0]: Save : 9.40 [ 781/ 0]: Clear : 6.00 [ 781/ 0]: Load : 25.20 [ 797/ 16]: Find : 62.40 [ 797/ 0]: Parse : 22.00 [ 797/ 0]: Total : 156.20 [ 797/ 0]: [ 797/ 0]: All done: 419.01 kiB [ 4922/ 0]: Speed Statistics for VSoft.YAML [ 4922/ 0]: Average of 5 repetitions (in ms) [ 4922/ 0]: Generate: 21.80 [ 4922/ 0]: Save : 315.80 [ 4922/ 0]: Clear : 25.00 [ 4922/ 0]: Load : 328.00 [ 4938/ 16]: Find : 3.00 [ 4938/ 0]: Parse : 256.40 [ 4938/ 0]: Total : 984.40 [ 4938/ 0]: [ 4938/ 0]: All done: 421.61 kiB I suspect the poor save performance is due to differences in the the tests and the library. If I change the Save test from TYAML.WriteToJSONFile(FYAML, aFileName); to TFile.WriteAllText(aFileName, TYAML.WriteToJSONString(FYAML)); Then we see [ 3547/ 0]: Speed Statistics for VSoft.YAML [ 3563/ 16]: Average of 5 repetitions (in ms) [ 3563/ 0]: Generate: 22.20 [ 3563/ 0]: Save : 37.40 [ 3563/ 0]: Clear : 21.40 [ 3563/ 0]: Load : 331.20 [ 3563/ 0]: Find : 0.00 [ 3563/ 0]: Parse : 256.40 [ 3563/ 0]: Total : 709.40 [ 3563/ 0]: [ 3563/ 0]: All done: 421.57 kiB So this was useful for improving json compatibility, but I don't think I am going to be chasing performance improvements unless there are some easy wins - it's fast enough.
-
Date detection algorithm for strings
Vincent Parrett replied to JohnLM's topic in Algorithms, Data Structures and Class Design
One major difference is that later versions user the utf-16 version of PCRE, whereas the earlier versions use the utf-8 version and do conversions between utf-8<->utf16. I diffed the source between XE7 and 13.0 and there are a lot of small changes, but mostly around the encoding handling. What issue are you having in XE7. -
RAD Studio 13 project build speed is slower
Vincent Parrett replied to Chau Chee Yang's topic in Delphi IDE and APIs
BTW, how many resource files are you building? -
RAD Studio 13 project build speed is slower
Vincent Parrett replied to Chau Chee Yang's topic in Delphi IDE and APIs
Unless your resources change often - I would avoid building them all the time. I guess you added the .rc files to the project? This has always been a bad idea imho - build the resources separately (create a batch file if needed) and then just use the .res files. -
It was added to the WinApi.Windows unit in 10.4, and as a class function to TThread in 11.0 - the latter abstracts for the different platforms.
- 15 replies
-
- gettickcount64
- tstopwatch
-
(and 2 more)
Tagged with:
-
RAD Studio 13 project build speed is slower
Vincent Parrett replied to Chau Chee Yang's topic in Delphi IDE and APIs
If you have the windows sdk installed you can change the project to use rc.exe - at least that would confirm whether resinator is to blame or not. -
Refactor – Rename (Type, Field, Property) Alternatives in Delphi 13
Vincent Parrett replied to dmitrybv's topic in Delphi IDE and APIs
Another options - https://github.com/SkliarOleksandr/DelphiAST - seems more actively maintained (Stefan told me he does not want to maintain DelphiAST). -
Refactor – Rename (Type, Field, Property) Alternatives in Delphi 13
Vincent Parrett replied to dmitrybv's topic in Delphi IDE and APIs
@Uwe Raabe if you decide to use DelphiAST - @Stefan Glienke fork is more up to date - https://github.com/sglienke/DelphiAST -
New YAML Parser Library - VSoft.YAML
Vincent Parrett replied to Vincent Parrett's topic in I made this
It's automatic - see TYAMLWriterImpl.FormatKey and TYAMLWriterImpl.FormatScalar -
New YAML Parser Library - VSoft.YAML
Vincent Parrett replied to Vincent Parrett's topic in I made this
No - but it's a nice idea - In theory it wouldn't too difficult to do. Of the top of my head, would need to maintain a stack of IInputReader and then when encountering an include tag oush the current reader and open a reader on the referenced file, when that reader is eof, pop a reader from the stack and continue. I don't have a need for that right now but I'm open to a pull request to implement it 😉 -
New Delphi features in Delphi 13
Vincent Parrett replied to David Heffernan's topic in RTL and Delphi Object Pascal
To add to the VS information - you can use Visual Studio Community Edition for commercial use: it's free for individual developers and non-enterprise organizations with fewer than 250 PCs or under $1 million USD in annual revenue. It's trivial to install and manage the license for the community edition - and it does a lot (no db limitations etc). That makes Delphi a very unattractive proposition for people starting out. The only place where Delphi wins out (ignoring the price) is for Desktop Windows applications. For everything else, there are better options. I wish it were not the case, but it's too far behind now to ever be able to compete in many spaces (like web, mobile etc). -
suggestion for 2 new su forum: AI usage and AI coding
Vincent Parrett replied to Javier Tarí's topic in Community Management
FWIW I am not using WSL - running in a windows terminal cmd. I have a simialr batch file - but for some reason it only works half the time. I'll try the sh route as claude code is using bash even under windows. -
suggestion for 2 new su forum: AI usage and AI coding
Vincent Parrett replied to Javier Tarí's topic in Community Management
I gave up trying to get it to compile and run tests, it worked at first with the batch file I created - but then it would randomly fail but claude would just blindly carry on and run the old exe - and then it started using the wrong command line parameters - that is despite me spending ages spelling it all out in claude.md Thanks for the tip about using the separate session - found several issues which point to an incomplete implementation of the algorithm 😢 More to do still