<FromGitter>
<caspiano> g'day crystal friends, i need a nice way to profile runtime allocations (not via MacOS Instruments). ⏎ i tried hooking into `new` and `finalize`of `Class` and `Struct` to not much success. from an inexperienced read of the compiler, it looks like the `new` method is generated at compile-time and no level of macro hacks allowed me to do a `previous_def` hack. ⏎ ⏎ has anyone had success in this, or have
<FromGitter>
<naqvis> @gdotdesign its because `[]` operator perform some checks on the validity of characters, as UTF chars might be greater than one byte. For your use case it would be better to first invoke `chars` on input string and then follow the same `[]` call . ⏎ ⏎ https://play.crystal-lang.org/#/r/aith
<FromGitter>
<gdotdesign> nice, thank you!
<FromGitter>
<caspiano> i've used valgrind for c in the past. I'll give it a shot with crystal! thanks for your help :)
<FromGitter>
<gdotdesign> With this optimization the parsing of 20K LOC Mint code went from 20 seconds to 6 🎉
<FromGitter>
<naqvis> 👏
<FromGitter>
<naqvis> I'm sure you can further improve that by replacing `[]' call with `unsafe_fetch`
fifr` has quit [Ping timeout: 260 seconds]
_ht has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
<FromGitter>
<gdotdesign> I think it's fine for now, but good to know :)
<FromGitter>
<gdotdesign> What is weird is that using the `--release` flag actually makes the parsing slower for some reason.
<FromGitter>
<Blacksmoke16> your `Schema` namespace is prob conflicting with YAML's
<FromGitter>
<Blacksmoke16> renaming it to like `Schemaa` works too
<sorcus>
Blacksmoke16: Yeap, you right. You're a genius :-D
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
yxhuvud has quit [Read error: Connection reset by peer]
deavmi has quit [Quit: Eish! Load shedding.]
yxhuvud has joined #crystal-lang
deavmi has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
DTZUZU has quit [Remote host closed the connection]
_ht has quit [Remote host closed the connection]
DTZUZU has joined #crystal-lang
<FromGitter>
<asterite> @gdotdesign `String#[]` is optimized for the ascii case, because an ascii char is always one byte. If there's non-ascii then `#[]` is much, much slower, it basically needs to iterate it from the beginning to find it. Alternatives are: call `.chars` and work with that (as suggested) or use `Char::Reader`
teardown has quit [Remote host closed the connection]
teardown has joined #crystal-lang
<FromGitter>
<gdotdesign> @asterite thanks! I've used `.chars` and that solved that specific problem still have the one where the parsing is slower using `--release` (but only since 0.36.0) I'll try to narrow it down some and make a benchmark.
fifr` has joined #crystal-lang
drakonis has joined #crystal-lang
_ht has joined #crystal-lang
chachasmooth has joined #crystal-lang
chachasmooth_ has quit [*.net *.split]
riffraff169 has quit [*.net *.split]
riffraff169 has joined #crystal-lang
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
postmodern has joined #crystal-lang
teardown has quit [Ping timeout: 268 seconds]
teardown has joined #crystal-lang
<f1refly>
when using the sqlite3 shards based on crystal-db, is there a best way to generate tables that will store my models?
<f1refly>
Thought I'd ask before trying to figure something out myself
<f1refly>
My program creates a new db if it doesn't find one, so if it could read how the tables should look like from the model classes that would be pretty cool
<FromGitter>
<Blacksmoke16> maybe not the best option then, but could just store the schemas and have your thing execute them against the connection
<f1refly>
Better than nothing I guess, yeah
<drakonis>
say, is there any soap library or would i have to roll out my own thing?
<FromGitter>
<Blacksmoke16> or at least have some of setup script/instructions. Idk if your app really needs to handle doing that on its own
<FromGitter>
<Blacksmoke16> like would the db really be changing/moving that often?
<FromGitter>
<Blacksmoke16> drakonis i dont know of any
<f1refly>
It's a very small database, <20 tables with not too many columns
<FromGitter>
<RespiteSage> @drakonis I don't think there's anything for SOAP. In general, it doesn't seem like there's a lot of XML library support.
<drakonis>
there's xml in the standard library
<FromGitter>
<RespiteSage> The standard library has a functional XML library, but outside of that I haven't seen much.
<f1refly>
And I'm still developing and adding more and changing things around, so currently I'm deleting the dev db and generate a new one with test data every launch
<FromGitter>
<Blacksmoke16> fair enough
<drakonis>
there's two incomplete soap libraries that i'm not aware of their current state of completion
<drakonis>
porting one from ruby would be outside of my current level of expertise
<FromGitter>
<RespiteSage> One of my "one day if I get the motivation" ideas is an XLM::Serializable library, which I think would make it easier to create libraries using XML.
<FromGitter>
<RespiteSage> *`XML::Serializable`
<drakonis>
i'm on a bit of a deadline as well
<drakonis>
so that's out of question
<FromGitter>
<RespiteSage> Oof. If you're using SOAP, are you interfacing with legacy software?
<FromGitter>
<RespiteSage> Could you find a C library and write Crystal bindings? That's usually easier than re-implementing complex stuff like this.
_ht has quit [Remote host closed the connection]
alexherbo25 has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo25 is now known as alexherbo2
<drakonis>
yes i am lol
<drakonis>
i wish they had a rest endpoint
<FromGitter>
<oprypin:matrix.org> if you have a deadline, can you just not use Crystal then?
<straight-shoota>
cause it's just a sample for the playground thing
<straight-shoota>
which operates on HTML
<straight-shoota>
adding a site generator to build that sample would just complicate things and is absolutely unnecessary
alexherbo26 has joined #crystal-lang
<FromGitter>
<oprypin:matrix.org> i -- what?
<FromGitter>
<oprypin:matrix.org> just plopping the generated output and leaving it to the reader to figure out what you changed?
alexherbo2 has quit [Ping timeout: 245 seconds]
alexherbo26 is now known as alexherbo2
<FromGitter>
<oprypin:matrix.org> i'd also say something about a javascript-less fallback but i suppose carc.in itself is hopeless in that regard
alexherbo2 has quit [Ping timeout: 246 seconds]
<FromGitter>
<jrei:matrix.org> coding in Lua... it feels between Shell and Ruby
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter>
<oprypin:matrix.org> oh god... that about summarizes it
<straight-shoota>
oprypin I don't understand. What do you want to know about what changes?
<straight-shoota>
I just took a rendered page from mkdocs-material, stripped a few things that are irrelevant for the demonstration and placed it as a sample.
<FromGitter>
<jrei:matrix.org> in this file new lines are weird
<straight-shoota>
you don't
<straight-shoota>
but the integral parts are all mentioned in the usage instructions in the readme
<straight-shoota>
there's nothing more to it, the example just places it in a realistic environment
<straight-shoota>
the sample is a usage demonstration, not a guide
<straight-shoota>
btw. what would be the best way to pull the js/css files into the crystal-book repo? git-submodule? Or does mkdocs have some tooling for that?
<straight-shoota>
Or just plain checkout via makefile
<FromGitter>
<oprypin:matrix.org> straight-shoota, i'd prefer less code to copypaste on the user side - i like https://highlightjs.org/usage/ approach. `CarcinPlay.insertAll(selector)` and even the selector can have the default ".crystal-play"
<FromGitter>
<jrei:matrix.org> npm : haha
<FromGitter>
<oprypin:matrix.org> straight-shoota, i don't have a good suggestion right now hmm. `npm` isn't even that funny..
<FromGitter>
<jrei:matrix.org> a shell script that wget
<FromGitter>
<oprypin:matrix.org> submodule seems like the perfect approach, other than the fact that submodules suck
<FromGitter>
<jrei:matrix.org> subtree?
<straight-shoota>
sure, such a simple api can be added for convenience
<straight-shoota>
ah yeah, I meant subtree
<FromGitter>
<jrei:matrix.org> but it is a bit worse to pin versions
<FromGitter>
<oprypin:matrix.org> i don't even know about subtree. isn't submodule much more common?
<FromGitter>
<jrei:matrix.org> don't know. subtree is more transparent, it is easy to not notice it
<straight-shoota>
Idk but subtree is the brother that actually doesn't suck
<FromGitter>
<jrei:matrix.org> suck less I would day.
<FromGitter>
<oprypin:matrix.org> i'd like to see any real example of its use
<straight-shoota>
it solves most if not all problems with submodules
<FromGitter>
<jrei:matrix.org> my dotfiles (lol)
<FromGitter>
<jrei:matrix.org> If you work with repositories you just want to sync and not bother with tags/versions - subtree it is definitely the best