Author Topic: Converting OXCE to rapidyaml  (Read 4853 times)

Online Yankes

  • Global Moderator
  • Commander
  • ***
  • Posts: 3346
    • View Profile
Re: Converting OXCE to rapidyaml
« Reply #120 on: Today at 01:03:15 pm »
@Yankes
>this is wrong signature for move constructor.
Well, I made them const so that I could more easily determine what was being copied, and what was being moved. That allowed me to find a few places in code which I fixed. But yeah, move constructor with const doesn't make sense.

>your version had three problems:
Nice catch. I should mention that, if a sav file is missing ---, it's corrupted, because the header contains critical data.

>I had helper class `class RawData`
I should probably have made readFileRaw and getYamlSaveHeaderRaw return RawData instead of char*.

YamlRootNodeReader currently copies that data to ryml::Tree's buffer (arena), so there's no need to keep that data.
I could make a version that would use parse_in_place instead of parse_in_arena, but then data would have to outlive YamlRootNodeReader instance, which means it would have to keep the data. It's not worth the effort, because it only makes parsing maybe 1% faster (skips 1 memory allocation + copy).

Anyway, yeah, unique_ptr with RawData would probably be a better solution instead of YamlRootNodeReader calling free itself. Probably also safer, because if there's an exception, the free doesn't get called.

Should I change stuff to use unique_ptr + RawData?

> and what was being moved

is this constructor even called? I recall that overload resolution always avoid this signature and `const&` is always preferred over `const&&`.

> Should I change stuff to use unique_ptr + RawData?

Yes, but RawData is unique_ptr + size. This means when you use one, you use both. For now we can replace `char*, size_t` args by `RawData`.

>  because it only makes parsing maybe 1% faster

Ok, if we remove other allocations then it would rise to araund 4%? Probably too much changes for small profit. For now we can keep as is, maybe in future after we stabilize codebase we can improve things here (like script too).

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9076
    • View Profile
Re: Converting OXCE to rapidyaml
« Reply #121 on: Today at 01:42:10 pm »
>3. compilation for ios in xcode
Based on those linker errors my best guess is that the rapidyaml cpp files aren't being compiled. Does a build log contain any rapidyaml hpp file compilation?
It could also be that the #include in Yaml.h (#include "../../libs/rapidyaml/ryml.hpp") is wrong, if the hpp files aren't at the right place.

Yeah, it will be something like that.
I remember now, I had similar issues when miniz library was added.
I solved it by copying miniz sources to "src" (from "../../libs"), adding the new ones to the project and modifying includes to refer to new ones.
Ugly, but worked.

I tried the same hacks now with rapidyaml, but unfortunately it didn't work... there's too many includes to modify, the thing simply doesn't see itself.
I really don't get it how such a simple thing as adding files to a project can be so FUCKING complicated and unintuitive as in Apple XCode.

We'll need someone who understands XCode to do this... I don't have the nerves for this.