From: Eric Wong Date: 2018-06-04T05:33:14+00:00 Subject: [ruby-core:87377] Re: [Ruby trunk Feature#14819] Efficient cstring to RVALUE typecasting for c extension gems sam.saffron@gmail.com wrote: > A general pattern I notice in the PG / MySQL and other gems is > a general need for a C string to RVALUE type casting. > > A lot of the problem is that the libpq likes returning strings > and you do not want to allocate an extra RVALUE string for an > IP address or Date and so on when returning data for the data > set. What Jeremy said about Date and IPAddr being in stdlib and not core. So I don't think this doable unless we start stuffing those things into core. Fwiw, the overhead of those objects (especially Time) has always been frustrating to me; I'd much rather have Time functionality built around Integers. So I wonder if we should support more operations on Integers instead of having fancy objects... > `rb_cstr2ipaddr` `rb_cstr2time` `rb_cstr2date` `rb_cstr2macaddr` Another thing: No more "cstr" functions, please. Any parsers should take an explicit size arg for safety and performance instead of relying on '\0' terminator. Unsubscribe: