[Firebird-devel] Coroutines
Hi! Learning node.js and its single-threaded model with asynchronous execution, I looked for things that can improve Firebird as well. It's obvious that things like boost asio may be a good thing when dealing with sockets and filesystem, but is not subject of this thread. Today I got up thinking in coroutines and then I thought how good it would be in the context of Firebird statement execution. Statement execution is very dirty code most because semantics of SUSPEND. Here I paste very small hand-made statement execution with SUSPEND semantics using boost coroutine (with v1, but there is a v2 library). http://pastebin.com/VR7KcnTa This is so nice (and apparent fast in Linux) that I'm going to investigate further. Architecture support is mentioned here: http://www.boost.org/doc/libs/1_61_0/libs/context/doc/html/context/architectures.html. I didn't even evaluated this table with attention now. I think some disruptive ideas sometimes are good to bring new ideas. Adriano -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
26.10.2016 13:33, Adriano dos Santos Fernandes wrote: > This is so nice (and apparent fast in Linux) that I'm going to > investigate further. It must be more than just nice to add gigabyte of boost sources or 30 megabytes library to Firebird. -- WBR, SD. -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
2016-10-26 15:24 GMT+03:00 Dimitry Sibiryakov : > It must be more than just nice to add gigabyte of boost sources or 30 > megabytes library > to Firebird I guess it's not about boost but about approach. I thought about the same approach in SciDB to provide nice way to implement new operators in one peace of well readable code but keep a pipeline processing of data. -- Roman Simakov -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
Why not callbacks? On 26 October 2016 at 15:51, Roman Simakov wrote: > 2016-10-26 15:24 GMT+03:00 Dimitry Sibiryakov : >> It must be more than just nice to add gigabyte of boost sources or 30 >> megabytes library >> to Firebird > > I guess it's not about boost but about approach. I thought about the > same approach in SciDB to provide nice way to implement new operators > in one peace of well readable code but keep a pipeline processing of > data. > > -- > Roman Simakov > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > Firebird-Devel mailing list, web interface at > https://lists.sourceforge.net/lists/listinfo/firebird-devel -- Egor Pugin -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
On 26/10/2016 12:22, Egor Pugin wrote: > Why not callbacks? > > When things start, it's the user who calls the engine and expects the engine to *return*, then user resumes the engine. We can't *callback* our caller. Adriano -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
26.10.2016 16:41, Adriano dos Santos Fernandes wrote: > We can't *callback* our caller. Why not? It is a matter of adding one method to your new API: class IEater { int pushData(IMessageMetadata* metadata, void* buffer); }; IStatus* IAttachment::execute(const char* SQL, IMessageMetadata* inputMetadata, void* inputData, IEater* outputCallback); -- WBR, SD. -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel
Re: [Firebird-devel] Coroutines
With callbacks you will smear code over two methods: caller, callback. Also you will need to keep some state! AFAIU coroutins solve this problem in more elegant manner using saving running context. Operator A push a portion of data to pipe and *goto* operator B which pull the portion process it and push the result to the next operator. In some time operator A get CPU again and produce neew portion. Note: every operator located in SINGLE place of code, but you keep pipeline (streams) whithout huge buffers. 2016-10-26 17:51 GMT+03:00 Dimitry Sibiryakov : > 26.10.2016 16:41, Adriano dos Santos Fernandes wrote: >> We can't *callback* our caller. > >Why not? It is a matter of adding one method to your new API: > > class IEater > { > int pushData(IMessageMetadata* metadata, void* buffer); > }; > > IStatus* IAttachment::execute(const char* SQL, IMessageMetadata* > inputMetadata, void* > inputData, IEater* outputCallback); > > > -- >WBR, SD. > > -- > The Command Line: Reinvented for Modern Developers > Did the resurgence of CLI tooling catch you by surprise? > Reconnect with the command line and become more productive. > Learn the new .NET and ASP.NET CLI. Get your free copy! > http://sdm.link/telerik > Firebird-Devel mailing list, web interface at > https://lists.sourceforge.net/lists/listinfo/firebird-devel -- С уважением Роман Симаков Директор департамента развития системных продуктов ООО "Ред Софт" skype: simakov_roman www.red-soft.ru -- The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel