Re: Quick C bindings
On Friday, 28 September 2018 at 16:39:14 UTC, Márcio Martins wrote: Hi y'all! If you'd be so kind and help me out here with a few questions/opinions: I would like to generate decent D bindings for https://github.com/libuv/libuv with as little pain as possible. What are you guys using these days to generate bindings? I remember trying Dstep a few years ago, but it didn't work very well for me at the time. What's new in this regard? I've been using the ones in dlang.org but have run into some issues, and would like to include bindings as part of my project, if it's not too painful. What is the state of shared libraries on the various platforms/compilers? I remember they were not supported everywhere and by all compilers, as this been addressed? also this exists: https://github.com/tamediadigital/libuv
Re: asdf json library moved to libmir
On Wednesday, 11 July 2018 at 21:58:29 UTC, WebFreak001 wrote: cool to hear that you don't let that library die. I like asdf but I never really had a usecase for it. When using vibe.d I just parse my json using their serializer. Additionally I never have the case of my input being line separated json, for example when reading a dub registry dump it's a 40MB json array where I don't really see application for asdf, or can it also be used with generic arrays that aren't line separated? i never understood why people do this. why would you ever generate such a big json, it requires a lot of memory to generate it too. that being said asdf also works in this case and i think you should even be able to stream non th e less (not 100% sure, if not it could/should be implemented). Anyway pretty cool library, would definitely use it if I ever see line separated json data in the wild. die Hoffnung stirbt zuletzt... anyway, really happy to see that asdf found a few uses and i can really recommend to try it out, even to replace the standard json libs in e.g. vibe.d, which is what i do too. Its not only faster but also easier, since you can use your structs/classes and have granular control over what properties are (de-)serialized.
Re: asdf json library moved to libmir
On Wednesday, 11 July 2018 at 22:21:32 UTC, Daniel Kozak wrote: I have tried it few days ago and it does not work for me at first. Because I always read only "Simple Example". One of my problem was that I have a struct with little different name that was attribute name used in json (positions and types has been correct), but it does not work and the error was really wierd so it took me a while until I have found out what was wrong. Other problem was with types when one json attribute can be a number or null Asdf was actually exactly created for this use case. You can do transformations when reading and writing. Also the null case is handled via different tools, please read the Readme and look into the API. If there is an use case that you seem not to be able to pull of, please file a ticket.
dynamically compile and load glue logic
in how far is it or would the following be possible: dynamically compile and execute some glue logic that is also written in D under linux? and what happens if that code uses phobos or other dub libs that are available in the host binary? especially the 2nd point is important as i would want to load 100's of those snippets. For the context: the idea is to create a streaming-ETL system where you can dynamically add/remove rules/modules. it would be great if logic could be written directly in D and operate on specific (library provided) objects.
Re: D for microservices
On Saturday, 24 February 2018 at 10:03:07 UTC, Joakim wrote: I've updated ldc master to use Yuxuan's druntime port, which means the upcoming ldc 1.8 release will likely be a viable Alpine/Musl cross-compiler out of the box, provided you give it a C/Musl cross-compiler/linker to work with, by using the bundled ldc-build-runtime tool: https://wiki.dlang.org/Building_LDC_runtime_libraries Cross-compiling has not been tested however: do people normally cross-compile to Alpine containers or build their software in Alpine itself? If the latter, building ldc from master on Alpine/x64 3.7.0 passes all of the druntime/phobos stdlib unit tests but one, so you're good to go there, as long as you don't need a pre-built binary. Maybe we'll put one out for ldc with the upcoming 1.8 release. great stuff, thank you! this will be very useful! Q: what would be needed to build a single binary (a la golang) that works in a FROM SCRATCH docker container?
Re: gRPC in D good idea for GSOC 2018?
On Friday, 19 January 2018 at 18:34:31 UTC, Ali Çehreli wrote: On 01/19/2018 02:14 AM, yawniek wrote: Could you please summarize what needs to be done and in what order. I would be happy to take active part in this effort. well, my personal opinion this should be designed/decided on a green field and not again make the mistake to try to include too much that is just laying around. i think vibe.d's eventcore may (or may not) be too opinionated and providing too much: 1a. define an overal strategy how/where protocols should be implemented and whether to focus on speed or "elegant" implementations. 1b. define how high performance servers should ideally be implemented and how that works together with D's concurrency models. plus provide the necessary things such as streams/ranges. ideally endorse/include/create one primary eventloop implementation or interface. possibly rusts tokyo.rs could be an inspiration? https://tokio.rs/docs/getting-started/tls/ 2a. create reference implementations for a http parser or e.g. port something like picohttpparser https://github.com/h2o/picohttpparser but this should adhere to the approach defined in 1. 3. implement crypto functions. e.g. port picotls ( https://github.com/h2o/picotls ) but also provide/maintain proper openssl bindings. 4. implement http/2 grpc also, think about what happens when the world starts switching to quic, the ietf wg makes good progress from what i saw. a totally different approach/decision would be to say, that D is a glue language and one should use C libraries (libuv, openssl, picohttpparser). but then i think tooling for integrating those should be improved/standardized (e.g. package manager, binding automation).
Re: gRPC in D good idea for GSOC 2018?
On Monday, 15 January 2018 at 19:28:08 UTC, Ali Çehreli wrote: I know a project where D could benefit from gRPC in D, which is not among the supported languages: https://grpc.io/docs/ Do you think gRPC support is worth adding to GSOC 2018 ideas? https://wiki.dlang.org/GSOC_2018_Ideas Ali Problem here is that D lacks a proper http/2 stack. unfortunately due to time constraints my libh2o binding project got stuck. Imo the real problem with D is still that phobos does not provide the important building blocks for today modern infrastrucutre: - fast and standardized eventloop compatible with Ds concurrency primitives - network protocol libs/ bindings ( http, http/2, tls, dns ) until there is effort to do this D will continue to be an ecosystem of hacks. I really like vibe.d but it comes with a lot of problems and it has the focus of providing a usable web framework and not implementing protocols in a fast and reusable way. so as long as "management" does not decide that internet protocols is something important in D nothing useful will come out. Just look how beautiful Golangs protocol implementations are and the whole ecosystem that focused effort spawned.
tooling/help for rewriting C projects with betterC
is there any tooling or tutorials on how one would approach a (partial) rewrite for bigger C projects that use e.g. cmake ? is there a way parts of it could be automated (if so which parts) ? this might help D a lot if people that want to learn/rewrite a library would get support and appropriate tooling. also best practices and help on how C patterns can be transformed to (safe!) d code.
OT: red-lang doing fundraising via DAO
interesting idea: http://www.red-lang.org/2017/12/leaping-into-future-red-goes-blockchain.html
Re: D as a Better C
On Wednesday, 23 August 2017 at 13:12:04 UTC, Mike Parker wrote: To coincide with the improvements to -betterC in the upcoming DMD 2.076, Walter has published a new article on the D blog about what it is and why to use it. A fun read. And I'm personally happy to see the love this feature is getting. I have a project I'd like to use it with if I can ever make the time for it! The blog: https://dlang.org/blog/2017/08/23/d-as-a-better-c/ Reddit: https://www.reddit.com/r/programming/comments/6viswu/d_as_a_better_c/ nice article, however very unfortunate introduction for the ADHD Generation as you start reading and you get put of by historical disabilities of D that are not true anymore. you may want to edit that and add the "until now" beforehand ;)
Re: Who here uses vibe-s3 from code.dlang.org?
On Monday, 14 August 2017 at 19:07:07 UTC, aberba wrote: On Sunday, 13 August 2017 at 21:38:37 UTC, yawniek wrote: On Tuesday, 8 August 2017 at 08:49:33 UTC, Andre Pany wrote: [...] the original goal of vibe-s3 was to allow streaming uploads of large files so that no memory/disk needs to be used. shelling out (calling aws console client) is definitly not an option. What exactly is missing or not working in its current state? from what i know file upload/download and multipart is working fine but setting options/headers is currently done via submitting the headers. thus all the interfaces are a bit crude. for the rest see the github issues. please report any problems in the github, also you can submit how you would EXPECT the API to work
Re: Who here uses vibe-s3 from code.dlang.org?
On Tuesday, 8 August 2017 at 08:49:33 UTC, Andre Pany wrote: On Monday, 7 August 2017 at 22:46:57 UTC, aberba wrote: vibe-s3 (https://code.dlang.org/packages/vibe-s3) is an Amazon s3 object storage API for D. Has anyone here used or tested it? What was your experiences? It has the tagline "this library is highly alpha and mostly untested. use at your own risk". I created a generator which uses the JS Api definitions https://github.com/aws/aws-sdk-js/tree/master/apis to create D structs and classes. Instead of calling the rest interfaces the generated code is calling the AWS console client, which is available for most operation systems. Unfortunatelly I do not have the property on this library and therefore I am not allowed to release it. But I can say it was an matter of some hours to implement it and you have immediatelly access to all AWS services. Kind regards André the original goal of vibe-s3 was to allow streaming uploads of large files so that no memory/disk needs to be used. shelling out (calling aws console client) is definitly not an option.
Re: Vibe.d - very low performance
On Thursday, 6 July 2017 at 07:27:24 UTC, Marek wrote: https://www.techempower.com/benchmarks/#section=data-r14=ph=plaintext C++, Java and Go frameworks have very high performance. Vibe.d is supposed to have similar performance, but in fact vibe.d performance is very low. Why? these tests are completely flawed, especially also in regards to todays world where you deploy microservices. having benchmarked vibe about 1.5 years ago i can confirm that with a little bit of tuning and choosing the right libs and compilers you can become very competitive, especially once the app gets more complex. write your own benchmark that operates on 1 core and test it. its mostly a test of how fast your http parser / json lib or db lib is. none the less, for D it would be good to be much higher in this ranking.
Re: anyone using msgpackrpc-d ? it's currently broken and doesn't seem maintained
On Monday, 12 June 2017 at 18:12:38 UTC, Timothee Cour wrote: any help on this would be most welcome: https://github.com/msgpack-rpc/msgpack-rpc-d/issues/16 Unfortunately I find the RPC support in D lacking. Having a good RPC integration for D is key for production use of D where one wants to integrate with other existing services (that could be written in other languages for eg) Msgpack rpc with vibe.d works. We used it. Its extremely fast, youll never get that speed with thrift. But also annoying, ghus we switched towards http + asdf
Re: Persistent key-value-store for D?
On Wednesday, 26 April 2017 at 17:06:52 UTC, krylon wrote: I looked at the DUB package registry and asked Google quite a bit now, but I did not found such a package for D. So my first question is - did I not look hard enough? I found a reimplentation of QDBM [1] (the spiritual ancestor of Tokyocabinet), but it does not seem to handle concurrency at all. Are there other options along those lines? (If there was one that also provides transactions, that would be awesome!) If I understand what I have read so far correctly, it is possible to access libraries written in C or C++ from D - in that case, I could just use Tokyocabinet directly, but I have not found any pointers on how to do this. Is this a feasible option, and if so, where can I find documentation on how to do this? i recommend leveldb http://code.dlang.org/packages/d-leveldb its easy to use and mostly faster than tokyocabinet ( only very specifically tuned tokyo btrees outperform leveldb) i used above library with great success. it also shows you how to do c bindings.
Re: A betterC modular standard library?
On Monday, 19 December 2016 at 05:59:07 UTC, Ilya Yaroshenko wrote: D - ??? awesome what ? What do we have better then Scala? Performance? NO. BRandomAccessRanges makes our performance less then C/C++. Clean and clever API in standard library? NO. We are placing our Range API whenever possible including RNGs. We have not a language standard for I/O. Half of Phobos is outdated to language standards. Best generics? NO. Scala is more powerful. -- What do we have awesome? Where D is the best? -- D is awesome for low-level system libraries in betterC mode. (and small text processing routines) This will make D great in other fields. while i mostly use D as a awesome high level language (with mediocre libs, and an inconsistent stdlib) i also think that D has an edge when it comes to building fast system level tools that used to be written in c: microservices, datatabases etc. however for that, as ilya mentioned it needs to be super user friendly to compile down a single static object/binary with no dependencies and a clear line on when phobos can/should/must be used and when not (e.g. create a view on phobos documentation that only shows things that work without druntime. add some official docs on how to use it) people turn to C to extend their language of choice because they need speed in a very narrow area. if that becomes as easy (or even easier, since there is dub!) as with C it would be a huge win for D, because people would start to extend their stuff with D. No other language is in a such good position as D, from what i see not that much needs to be done to make that work. i see a huge opportunity there
automatically adding rust/cargo libs as dependencies in dub
in how far would it be possible to integrate and statically link rust libraries within dub projects? this could give a huge boost to the library ecosystem if it would be as easy (or easier) as statically linking against other .a files.
Re: The XML and JSON library
On Friday, 30 September 2016 at 09:41:55 UTC, Chris wrote: On Thursday, 29 September 2016 at 21:32:03 UTC, cym13 wrote: It's not as if it were the only json library though, asdf for example isn't linked to any web framework https://github.com/tamediadigital/asdf I like the name `asdf` (it's the same I type when I need random text input). Is there a tutorial / blog / article about it? Maybe it needs more promotion. For the moment it says: ` ! Currently all ASDF Method names and all UDAs are in DRAFT state, we might want want make them simpler. Please submit an Issue if you have input. ! ASDF is currently only very loosely validating jsons and with certain functions even silently and on purpose ignoring failing Objects (see below). ` So not sure, if it's 100% usable. its definitly 100% usabe, we use it in production. and it has a much easier API than all the other libs. we created it especially for the purpose of easy (and blazing fast!) data extraction from json. give it a spin and report feedback. unfortunately i have not had the time yet to write a more detailed blog article. The reason the warning is there is: - validation: we usually do not care about a few corrupt records within millions, thus there is this feature to silently ignore those, i think you still can make these records fail loudly. - we don't know yet where asdf is bad at, thus we need more feedback - we are open to change the naming convention of the attributes if someone comes up with good reasoning
Re: SQLite-D goes beta!
On Tuesday, 20 September 2016 at 20:37:33 UTC, Stefan Koch wrote: On Tuesday, 20 September 2016 at 20:34:19 UTC, Karabuta wrote: Great work! Can't wait to see sample code :) It's in app.d also see test.d very elegant! congrats!
Re: Project Highlight: Timur Gafarov
On Friday, 16 September 2016 at 14:12:49 UTC, c-v-i wrote: On Friday, 16 September 2016 at 12:53:44 UTC, Mike Parker wrote: What started out as a highlight of Timur's open source game, Atrium, turned into an introduction to several of his D projects. And it looks like I've managed to make this announcement without a typo in the title this week. If you notice any mistakes in the blog post, please let me know! The post: https://dlang.org/blog/2016/09/16/project-highlight-timur-gafarov/ reddit: https://www.reddit.com/r/programming/comments/531po8/from_the_d_blog_introducing_an_open_source_game/ can someone build atrium ? yes its easy, just fix the 3 lines of code and add the full module path and off you go.
Re: new XML and JSON libs and replacement of std.net.curl
On Tuesday, 16 August 2016 at 10:06:05 UTC, ikod wrote: On Tuesday, 16 August 2016 at 09:16:40 UTC, yawniek wrote: There is common http message parser that used in nginx and nodejs. I think it can be ported from C to D. that is pico, see: https://github.com/nodejs/http-parser/pull/200 https://github.com/h2o/picohttpparser/issues/7 But async library accepted as standard need before this. i don't think there is any temporal dependency between an eventloop and a http parser making it into phobos. only later then a simple http server or client needs both (+ TLS ).
Re: new XML and JSON libs and replacement of std.net.curl
imo things should be modularized. so there should be (fast) protocol parsers first, something like https://github.com/h2o/picohttpparser or https://github.com/seanmonstar/httparse then a very simple eventloop that has abstractions and range based interfaces for reading/writing data into different types of sockets. and at this point we need to start talking about Fibers and if/how they work with the eventloop. and how to make async code nice in D. Rust has a new approach that looks very promising: http://aturon.github.io/blog/2016/08/11/futures/ only then we can think about making http calls, using TLS and having a webserver. as for TLS a dual approach might be needed anyway, because there people would probably want to be able to dynamically link to a system provided library such as OpenSSL. => in my opinion the groundwork (parsers, eventloop) etc should be DESIGNED thoroughly and we should not just take the best available library and stuff it into phobos. and there is no shame to look at Go and rust, i still think D would have a good future as Language to implement Services.
Re: JSON Serialization with runtime filtering.
On Friday, 22 July 2016 at 12:36:31 UTC, Alexander Milushev wrote: I there any json serialization library which allow to make decision about ignoring fields in runtime? I trying to write rest client but server accept either 'cmd' or 'args' field for example and I need to find solution. can you give an example? i'm not sure what you mean by "ignore at runtime" if its simply ignoring fields of a struct then thats easily doable with https://github.com/tamediadigital/asdf
Zurich D Meetup
sorry for the short notice, but i'm glad to host Ilya with a talk on scientific computing with D. more infos here: http://www.meetup.com/de-DE/Zurich-D-Programming-Language-Meetup/events/232534480/?eventId=232534480
Re: Singleton Pattern
On Thursday, 5 January 2012 at 22:15:32 UTC, asm wrote: how can i implementing the singleton pattern in D? https://p0nce.github.io/d-idioms/#Leveraging-TLS-for-a-fast-thread-safe-singleton
Re: How to get current time as long or ulong?
On Tuesday, 5 July 2016 at 18:16:31 UTC, Charles Hixson wrote: What I'm looking for is the opposite of the "FromUnixTime" function. i often use long toNsUnixTime(SysTime t) { return (t.stdTime - 621_355_968_000_000_000L)*100; } as a helper. any chance that something like this can be put into phobos? its needed to work with external libraries or network services that expect this format.
Re: AWS SDK
On Sunday, 26 June 2016 at 23:06:02 UTC, Jadbox wrote: Is there an AWS library in the works for D? It's seriously the main blocker for me to push adoption of the language internally. If not, I can try to invest time into making one, but I could use help. (fyi, there's one in the works for Rust: https://github.com/rusoto/rusoto) what services do you need? the important bits, such as auth are around, but you likely need to implement some stuff for yourself. we have an incomplete s3 libary with https://github.com/tamediadigital/vibe-s3 there is also some code for kinesis and dynamo around but its likely outdated.
Re: problem using ldc 1.0.0 as D compiler
On Tuesday, 21 June 2016 at 16:26:14 UTC, Satoshi wrote: On Monday, 20 June 2016 at 11:28:58 UTC, Antonio Corbi wrote: Hi folks! I'm using ldc version: LDC - the LLVM D compiler (1.0.0): based on DMD v2.070.2 and LLVM 3.8.0 built with DMD64 D Compiler v2.071.0 Default target: x86_64-unknown-linux-gnu Host CPU: core2 [...] I have the same problem with LDC 1.1.0 on Arch Linux you could use ldc-git from aur, https://aur.archlinux.org/packages/ldc-git/ this has static phobos
Re: Areas of D usage
On Thursday, 2 June 2016 at 13:59:13 UTC, Seb wrote: [1] Overview: http://dlang.org/overview.html [2] Preview: http://dtest.thecybershadow.net/artifact/website-915b9bd5028d67e186487141083523937b417cd7-32649b6cb8d58891a4c66946a8f75141/web/areas-of-d-usage.html [3] PR: https://github.com/dlang/dlang.org/pull/1314 [4] DLang Tour: http://tour.dlang.io/ great stuff. i would remove (or push down) XOmB. its bad if the first link is a very outdated project (yes there is a branch that had some activity this year, but still). powernex is much more interesting since its under active development.
Re: Linux and htod
On Thursday, 16 June 2016 at 19:04:38 UTC, bachmeier wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across this post, you do not need htod, dstep, or any other tool to call C libraries from D. dstep generates bindings to C libraries for you. You can create the bindings yourself in your D source files, and if you only want to call a couple of functions from a particular C library, that's the most convenient. http://dlang.org/spec/interfaceToC.html The wording of the question implies that one of these tools is required to call into C libraries, which is not correct. https://wiki.dlang.org/D_binding_for_C is also helpful they should be put together.
Re: I'd love to see DScript one day ...
On Tuesday, 14 June 2016 at 01:36:48 UTC, Yuxuan Shui wrote: On Tuesday, 14 June 2016 at 00:55:52 UTC, Walter Bright wrote: On 6/13/2016 5:13 PM, H. S. Teoh via Digitalmars-d wrote: My *real* dream is for D (or some suitable subset thereof) to replace Javascript in browsers. But that's a very distant, if at all even possible, dream. :-D It's a great dream! Don't we have a pretty efficient JIT javascript implementation in D already? https://github.com/higgsjs/Higgs higgs doesn't work if you want to zerocopy share data between D and the scripting language. so D here is more or less just the implementation language.
Re: interfacing with C: strings and byte vectors
On Saturday, 11 June 2016 at 10:26:17 UTC, Mike Parker wrote: On Saturday, 11 June 2016 at 09:32:54 UTC, yawniek wrote: thanks mike for the in depth answer. i forgot to add a few important points: - the strings in vec_t are not c strings - vec_t might contain other data than strings the original ctor i pasted actually doesn't even work, temporarly i solved it like this(string s) { char[] si = cast(char[]) s; //i'm scared base = si.ptr; len = si.length; } is there a better solution than to fearlessly cast away immutability? i guess i could just make a second vec_t that has immutable base and length that can be used in D to stay clean, would that be worth anything? now what i still don't have a proper idea for is how can i create wrappers for the methods accepting vec_t in a clean way. for the vec_t that are allocated in D-land we can state that the C libs will not modify the data. there is a lot of functions that accept vec_t. is there no way to have strings auto cast to vec_t ? another way i see is a UDA that generates the wrapper function(s). other ideas?
Re: I'd love to see DScript one day ...
On Friday, 10 June 2016 at 22:01:53 UTC, Walter Bright wrote: On 6/10/2016 3:55 AM, Chris wrote: > Cool. I'd love to see `DScript` one day - and replace JS once and for all ... > well ... just day dreaming ... Dreams are reality: https://github.com/DigitalMars/DMDScript unfortunately this is unmaintained, has no docs and isn't working on linux/os x. having an ecma script implementation that is able to access D data would be very usefull for performant scripting.
interfacing with C: strings and byte vectors
my C library works a lot with strings defined in C as: struct vec_t { char *base; size_t len; } is there a easy way to feed regular D strings to functions that accept vec_t* without creating a vec_t every time or do i write wrappers for these functions and if so, what is the most elegant way to build them? so far i defined vec_t as: struct vec_t { char *base; size_t len; this(string s) { base = s.ptr; len = s.lenght; } nothrow @nogc inout(char)[] toString() inout @property { return base[0 .. len]; } nothrow @nogc @property const(char)[] toSlice() { return cast(string) base[0..len]; } alias toString this; } but i guess there is a more elegant way?!
Re: [OT] Do you see a problem in this serialization format ?
On Tuesday, 7 June 2016 at 11:22:55 UTC, Basile B. wrote: On Tuesday, 7 June 2016 at 10:24:56 UTC, WebFreak001 wrote: On Tuesday, 7 June 2016 at 02:11:55 UTC, Basile B. wrote: I had to make a custom format because SDL would have the same problem as JSON. I need to store the type, so key = value does not work and an object (that contains name = "thename", type = "thetype", value = "value") must be created for each property. The serialisation data become huge and is painfull to read. not necessarily and i don't completely understand why you want to include the schema in each message. this is a lot of bloat. and once you need more complicated datastructures it will be hard anyway and you need manual glue code. e.g. `Dlist!string[] mylist = ` i would go for protobufs, thrift or if you want something easy to parse then json maybe with json schema. plug: try https://github.com/tamediadigital/asdf it was more or leass created for what you want. - no object instantiation overhead - instead of "factory" methods you just use the deserializer methods
Re: Benchmark Dlang vs Node vs Ruby
On Friday, 27 May 2016 at 16:47:19 UTC, Daniel Kozak wrote: Why not to use distribute oprion? Dne 27. 5. 2016 17:35 napsal uživatel "yawniek via Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>: it its a flawed strategy. what you should do is let the kernel handle it and use SO_ REUSEPORT libasync supports it. see e.g. https://github.com/rejectedsoftware/vibe.d/issues/1139 and https://lwn.net/Articles/542629/
Re: Benchmark Dlang vs Node vs Ruby
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even possible ? I am doing something wrong ? Here are the numbers with the project : https://github.com/llaine/benchmarks/blob/master/README.md you should: - use this https://github.com/etcimon/ddb Postgres client - fix your logic - NOT use option distribute - use LDC2 beta2 as compiler with release flag - use neweset vibe.d version and then your results should be easily above 1000 rps
Re: Async or event library
On Tuesday, 10 May 2016 at 13:34:36 UTC, chmike wrote: vibed uses libevent, a C library. The discussion is regarding a possible pure D equivalent of libevent. libasync is an interesting proposal but it is apparently slower than libevent. I don't know the current status because vibed improved its performance in the last months. My initial question is if there is a working group I could join to work on this pure D async library. I'm interested in working on the subject. from my experience its not really slower than libevent and it could be made even faster by taking some time to profile it. plus its battle tested in production and fully cross platform. also, it will most probably not be your bottleneck.
Re: The end of curl (in phobos)
On Saturday, 7 May 2016 at 09:46:36 UTC, ikod wrote: What do you mean under re-licensing? you added GPL to requests, this is incompatible with phobos and your code can not be included. could it be changed to boost licence?
Re: The end of curl (in phobos)
On Friday, 6 May 2016 at 09:21:43 UTC, Andrei Alexandrescu wrote: On 5/6/16 10:32 AM, Robert burner Schadek wrote: As discussed yesterday at DConf, curl in phobos must go. The plan is as follows. 1. undocument everything curl related in may 2016 2. deprecate everything curl related in may 2017 3. delete everything curl related in may 2018 3.1 move curl stuff to undead PR: https://github.com/dlang/phobos/pull/4283 0. Write curl replacement https://github.com/ikod/dlang-requests looks very promising, maybe it could be re-licenced?
vibe-s3: vibe compatible s3 client
vibe compatible s3 client that supports chunked uploads. pretty rough around the edges, but basic things work. supports chunked uploads and thus needs at least vibe 0.7.28. https://github.com/tamediadigital/vibe-s3 http://code.dlang.org/packages/vibe-s3 cheers yannick
lldb on os x: can't display stack variable
is there a way to make lldb work on os x? if i set breakpoints lldb stops but i can't display anything with `stack variables`.
Re: vibe.d is blocking threads
On Wednesday, 27 April 2016 at 13:00:29 UTC, RuZzz wrote: Code: import std.concurrency; import core.thread; //import vibe.http.client; // If uncommented this line, the thread "worker" does not start void worker() { foreach (i; 0 .. 5) { Thread.sleep(500.msecs); writeln(i, " (worker)"); } } [...] you should use the built in concurrency primitives vibe.d offers. especially runTask and runWorkerTask. see the vibe.d examples and http://vibed.org/features
Re: Proposed: start DConf days one hour later
On Wednesday, 27 April 2016 at 18:36:54 UTC, Andrei Alexandrescu wrote: The folks at Sociomantic suggested to start at 10:00 AM instead of 9:00 AM, therefore shifting the end time by one as well. Please reply with thoughts on this! We're particularly concerned about folks who need to take off early on Friday. -- Andrei from my experience hardly anyone is fully awake before 10am in berlin anyway. :P
Re: vibe.d kafka driver & probabilistic linear counting
On Monday, 11 April 2016 at 09:08:34 UTC, André wrote: On Sunday, 10 April 2016 at 10:51:38 UTC, yawniek wrote: we pushed 2 new projects: a native kafka driver to work with the vibe.d eventloop http://code.dlang.org/packages/kafka-d it's not full featured yet (no zookeeper) but the basic use cases work fine. throughput depends on the buffer sizes but we achieved gigabit speeds in benchmarks. thanks to Piotr for most of the implementation. The news on Kafka are really great! Thanks a lot for the work! Did you inform the Kafka developers that there is a new language supported? Maybe this could be added to this Wiki page which lists all supported libs and languages: https://cwiki.apache.org/confluence/display/KAFKA/Clients. Regards, André Not yet, i have too little outside feedback yet. So please test and fill tickets with bugs/feature requests on gh
Re: how to parse a string into a phobos datatype with additional logic
On Thursday, 7 April 2016 at 18:29:19 UTC, Jonathan M Davis wrote: On Thursday, April 07, 2016 07:45:06 yawniek via Digitalmars-d-learn wrote: So, while I understand your frustration, I just don't see any other sane way to approach this problem than what you've done. Putting it all in a wrapper type encapsulates it in a way that it can actually work, whereas the other options get messy really fast if they're possible at all. - Jonathan M Davis thank you Jonathan for the extensive answer, really helpful. And the Longer i think about it the more i come to the conclusion that its actually not even that ugly as it allows you to easily add more logic to the structs if needed. i already extensively alias standard datatypes to another name where it is used in a specific context (latest example: alias ColumnName = string) and it became helpful because you can easily refactor it to something bigger.
Re: VibeCustomMain not working
On Thursday, 7 April 2016 at 13:40:17 UTC, Rene Zwanenburg wrote: On Thursday, 7 April 2016 at 13:25:29 UTC, Jerry wrote: I generated a visuald project and tried that. Now suddenly it is working as expected. So I guess it's a bug in dub. That's possible of course, but I'd expect something so fundamental breaking to be noticed sooner. Just to make sure, could you run dub with --force to rule out that it's picking up some stale object files from somewhere? i also had it multiple times that my build was broken and not even --force would fix it. then i deleted ~/.dub and .dub and rebuild everything and suddenly it worked.
Re: how to parse a string into a phobos datatype with additional logic
On Thursday, 7 April 2016 at 08:03:34 UTC, Edwin van Leeuwen wrote: You can try this library: https://code.dlang.org/packages/dateparser nope this will not work and the question is broader: i want to have a standard datatype parsed in a specific way and so that i can use other std library tools such as csvparser to then do the job. parsing unixtime with subsecond resolution was just one example, there is a lot of cases where you want to do some tranformation e.g. "33%" -> 0.33f my solution with defining a custom struct works, but it would be nice if you somehow could hook into this process in a cleaner way.
how to parse a string into a phobos datatype with additional logic
what is the way one is supposed to parse e.g. a double of unixtime (as delived by nginx logs) into a SysTime? currently i'm creating a wrapper struct around SysTime with alias this as: https://gist.github.com/yannick/6caf5a5184beea0c24f35d9d4a4c7783 really ugly imho. is there a better way to do this?
Re: BitArray: count the number of bits set
On Tuesday, 1 March 2016 at 09:32:20 UTC, Andrea Fontana wrote: Maybe you should look for "hamming weight" :) maybe. and here is a snowman for you: ☃ the question was if it exists for BitArray in phobos. https://issues.dlang.org/show_bug.cgi?id=10239 so apparently its really missing in phobos BitArray. the algo is even described in TDPL.
BitArray: count the number of bits set
i figured i can count the number of bits set for a BitArray with std.algorithm : count: BitArray([0,0,1]).bitsSet.count() but this seems not very optimal, is there a faster way directly accessible trough phobos? ideally something that is optimized by the compiler.
[OT] Why C++ sucks (2016.02 edition)
via HN: http://dorinlazar.ro/why-c-sucks-2016-02-edition/
Re: Alternate databases
On Saturday, 20 February 2016 at 13:09:53 UTC, Andrew Edwards wrote: I'm searching for client drivers for the following databases. Are the any available? https://rethinkdb.com/docs/install-drivers/ http://docs.basho.com/riak/latest/dev/references/client-implementation/ Thanks, Andrew none for riak afaik, for rethink i found: https://github.com/search?utf8=%E2%9C%93=language%3Ad+rethinkdb=Repositories=searchresults if you try them, please report back if any of them is already usablee
Re: Another new io library
On Wednesday, 17 February 2016 at 07:15:01 UTC, Steven Schveighoffer wrote: On 2/17/16 1:58 AM, Rikki Cattermole wrote: What would be the benefit of having it an input range by default? -Steve https://en.wikipedia.org/wiki/Principle_of_least_astonishment something the D community is lacking a bit in general imho. but awesome library, will definitely use, thanks!
Re: TIOBE February 2016.... 15 ?!
On Wednesday, 3 February 2016 at 18:36:35 UTC, Andrei Alexandrescu wrote: On 02/03/2016 02:06 AM, cym13 wrote: It's all true, D rose up 6 positions: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html I don't quite know what the leading factor for that change was but it sure will be great for its image. Thanks for the info. Probably not worth posting to reddit, but I did post it on FB and Twitter: https://facebook.com/dlang.org/posts/1220250531321959 https://twitter.com/D_Programming/status/694948280858492928 Andrei i hate to spoil the party but: http://donnemartin.com/viz/pages/2015
Re: Getting the body of a HTTP Request
On Wednesday, 27 January 2016 at 23:42:54 UTC, brian wrote: Anyone able to shed some light on what the structure of the response is, and how I can read/output it all? Regards Brian its unlikely that vibe client misses something. for debugging i would try to go trough all requests with curl on the commandline and see if you can make it work there. in case you are looking for an oauth client implementation there seems to be this https://github.com/danielsson/dlang-oauth2 that works with vibe.d if you add the switch for it. not sure if it works but it might be a good example.
Re: [dlang.org] new forum design
i really like the new design, congratulations! the only thing missing is proper code formatting with highlighting
Re: Are there any D scripting engines for use with D?
On Monday, 4 January 2016 at 19:04:48 UTC, Max Klyga wrote: On 2016-01-04 18:40:03 +, Jason Jeffory said: The fastest one would probably be Lua - http://code.dlang.org/search?q=lua But there are other options: Python - http://code.dlang.org/packages/pyd Javascript - http://code.dlang.org/search?q=javascript and http://pointersgonewild.com/higgs/ Croc (previously miniD, a scripting language implemented in D) - http://jfbillingsley.com/croc/ there is also http://code.dlang.org/packages/d_mruby mruby is really nice. but i agree, a more native language that would not need to push data via a stack but instead had direct access to strings or defined objects would be something really helpful.
Re: vibe.d benchmarks
On Thursday, 31 December 2015 at 08:23:26 UTC, Laeeth Isharc wrote: Isn't there a decent chance the bottleneck is vibe.d's JSON implementation rather than the framework as such ? We know from Atila's MQTT project that vibe.D can be significantly faster than Go, and we also know that its JSON implementation isn't that fast. Replacing with FastJSON might be interesting. Sadly I don't have time to do that myself. this is not the same benchmark discussed elsewhere, this one is a simple echo thing. no json. it just states that there is some overhead around on various layers. so its testimony is very limited. from a slightly more distant view you can thus argue that 50k rps vs 150k rps basically just means that the framework will most probably not be your bottle neck. none the less, getting ahead in the benchmarks would help to attract people who are then pleasantly surprised how easy it is to make full blown services with vibe. the libasync problem seem seems to be because of TCP_NODELAY not being deactivated for local connection.
Re: DUB problems
On Thursday, 31 December 2015 at 08:51:42 UTC, Daniel Kozak wrote: I try to build vibe-d Hello world app with dub, but I have many problems with dub, nothing works at all Error: Output file 'client.o' for module 'vibe.http.client' collides with previous module 'vibe.db.mongo.client'. See the -oq option and allmost nothing works as expected. How can I do one simple thing: Compile vibe.d with libasync and with ldc compiler os? versions? it kind of depends. i just tested this on linux. dub init -t vibe.d foo cd foo cat dub.json { "name": "foo", "description": "A simple vibe.d server application.", "copyright": "Copyright © 2015, yannick", "authors": ["yannick"], "dependencies": { "vibe-d": "~>0.7.26" }, "versions": ["VibeDefaultMain"], "subConfigurations": { "vibe-d": "libasync"} } ws01% cat dub.selections.json { "fileVersion": 1, "versions": { "memutils": "0.4.3", "vibe-d": "0.7.26", "libevent": "2.0.1+2.0.16", "libev": "5.0.0+4.04", "openssl": "1.1.4+1.0.1g", "libasync": "0.7.5" } } dub build --compiler=ldc -b release --combined ldc --version LDC - the LLVM D compiler (0.16.1): based on DMD v2.067.1 and LLVM 3.7.0 dub --version DUB version 0.9.24-rc.2+18-g4fece3c note the dub switches compiling in debug mode or without --combined crashes!
Re: vibe.d benchmarks
On Thursday, 31 December 2015 at 12:09:30 UTC, Etienne Cimon wrote: On Thursday, 31 December 2015 at 08:51:31 UTC, yawniek wrote: the libasync problem seem seems to be because of TCP_NODELAY not being deactivated for local connection. That would be the other way around. TCP_NODELAY is not enabled in the local connection, which makes a ~20-30ms difference per request on keep-alive connections and is the bottleneck in this case. Enabling it makes the library competitive in these benchmarks. obvious typo and thanks for investigating etienne. @daniel: i made similar results over the network. i want to redo them with a more optimized setup though. my wrk server was too weak. the local results are still relevant as its a common setup to have nginx distribute to a few vibe instances locally.
Re: vibe.d benchmarks
On Thursday, 31 December 2015 at 15:35:45 UTC, Ola Fosheim Grøstad wrote: I don't know how the benchmarks are set up, but I would assume that they don't use a local socket. I wonder if they run the database on the same machine, maybe they do, but that's not realistic, so they really should not. its actually pretty realistic, one point of having a fast webserver is that you can save on ressources. you get a cheap box and have everything there. very common.
Re: vibe.d benchmarks
On Wednesday, 30 December 2015 at 20:38:58 UTC, Daniel Kozak wrote: V Wed, 30 Dec 2015 20:32:08 + yawniek via Digitalmars-d <digitalmars-d@puremagic.com> napsáno: Which async library you use for vibed? libevent? libev? or libasync? Which compilation switches you used? Without this info it says nothing about vibe.d's performance :) the numbers above are libevent in release mode, as per original configuration. for libasync there is a problem so its stuck at 2.4 rps. etcimon is currently investigating there.
Re: vibe.d benchmarks
Sönke is already on it. http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/post/29110 i guess its not enough, there are still things that make vibe.d slow. i quickly tried https://github.com/nanoant/WebFrameworkBenchmark.git which is really a very simple benchmark but it shows about the general overhead. single core results against go-fasthttp with GOMAXPROCS=1 and vibe distribution disabled on a c4.2xlarge ec2 instance (archlinux): vibe.d 0.7.23 with ldc Requests/sec: 52102.06 vibe.d 0.7.26 with dmd Requests/sec: 44438.47 vibe.d 0.7.26 with ldc Requests/sec: 53996.62 go-fasthttp: Requests/sec: 152573.32 go: Requests/sec: 62310.04 its sad. i am aware that go-fasthttp is a very simplistic, stripped down webserver and vibe is almost a full blown framework. still it should be D and vibe.d's USP to be faster than the fastest in the world and not limping around at the end of the charts.
Re: D could catch this wave: web assembly
https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
grpc
would anyone be interested in doing the work for adding D / vibe.d to https://github.com/grpc/grpc ? we currently lack the manpower but would be able to sponsor it (or parts, depending on the effort needed). grpc is probably going to be the dominant rpc system for building a microsrvices architecture. even though i prefer msgpack-rpc i think it would be very valuable in terms of connecting to e.g. GO services.
failing regex
regex from https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38 seems to work in other languages, not so in D: auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?".regex(); ( https://gist.github.com/4334e35e68497c0517db ) results in ``` dmd -run failing_regex.d std.regex.internal.ir.RegexException@/usr/local/Cellar/dmd/2.069.0/include/d2/std/regex/internal/parser.d(1392): invalid escape sequence Pattern with error: `(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!` <--HERE-- `\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?` 4 dmd_run68HuB5 0x0001044d211d @trusted void std.regex.internal.parser.Parser!(immutable(char)[]).Parser.error(immutable(char)[]) + 297 5 dmd_run68HuB5 0x0001044da604 ref @trusted std.regex.internal.parser.Parser!(immutable(char)[]).Parser std.regex.internal.parser.Parser!(immutable(char)[]).Parser.__ctor!(const(char)[]).__ctor(immutable(char)[], const(char)[]) + 160 6 dmd_run68HuB5 0x0001044cc732 @safe std.regex.internal.ir.Regex!(char).Regex std.regex.regexImpl!(immutable(char)[]).regexImpl(immutable(char)[], const(char)[]) + 86 7 dmd_run68HuB5 0x0001044e944f std.regex.internal.ir.Regex!(char).Regex std.functional.__T7memoizeS95_D3std5regex18__T9regexImplTAyaZ9regexImplFNfAyaAxaZS3std5regex8internal2ir12__T5RegexTaZ5RegexVii8Z.memoize(immutable(char)[], const(char)[]) + 475 8 dmd_run68HuB5 0x0001044cc6bc @trusted std.regex.internal.ir.Regex!(char).Regex std.regex.regex!(immutable(char)[]).regex(immutable(char)[], const(char)[]) + 64 9 dmd_run68HuB5 0x0001044cc5de _Dmain + 46 10 dmd_run68HuB5 0x000104509ac3 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39 11 dmd_run68HuB5 0x0001045099fb void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 55 12 dmd_run68HuB5 0x000104509a68 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 44 13 dmd_run68HuB5 0x0001045099fb void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 55 14 dmd_run68HuB5 0x00010450994d _d_run_main + 497 15 dmd_run68HuB5 0x0001044cc677 main + 15 16 libdyld.dylib 0x7fff8e5185c8 start + 0 17 ??? 0x 0x0 + 0 ``` bug or did i do something wrong?
Re: regex format string problem
Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit limited, i have 15M+ different User Agents with all kind of weird cases, sometimes not even the extensive ua-core regexs work. (if you're interested for testing let me know) Also once you do get yours working, you'll want to use ctRegex and generate a file with all of them in it. That'll increase performance significantly. that was my plan. Reguarding regex, if you want a named sub part use: (?[a-z]*) Where [a-z]* is just an example. I would recommend you learning how input ranges work. They are used with how to get the matches out, e.g. auto rgx = ctRegex!`([a-z])[123]`; foreach(match; rgx.matchAll("b3")) { writeln(match.hit); } i'm aware how this works, the problem is a different one: i do have a second string that contains $n's which can occur in any order. now of course i can just go and write another regex and replace it, job done. but from looking at std.regex this seems to be built in, i just failed to get it to work properly, see my gist. i hoped this to be a 1liner.
regex format string problem
hi! how can i format a string with captures from a regular expression? basically make this pass: https://gist.github.com/f17647fb2f8ff2261d42 context: i'm trying to write a implementation for https://github.com/ua-parser where the regular expression as well as the format strings are given.
Building the Docs with checked out code downoads old dmd
i'm trying to build the docs as per http://wiki.dlang.org/Building_DMD#Building_the_Docs i have a working setup to build the latest dmd/druntime/phobos but somehow the makefile tries to download an old dmd version and my bandwith currently is a bit restricted and i want an offline version. also the documentation is a bit unclear on what actually happens and is being built. would be really helpful.
Re: Release vibe.d 0.7.26
On Wednesday, 4 November 2015 at 07:41:34 UTC, Sönke Ludwig wrote: http://vibed.org/blog/posts/vibe-release-0.7.26 congrats and thanks! its exciting to see vibe moving so fast
Re: Please vote for the DConf logo
On Wednesday, 4 November 2015 at 09:30:30 UTC, Andrei Alexandrescu wrote: Reply to this with 1.1, 1.2, 2, or 3: 1) by ponce: Variant 1: https://github.com/p0nce/dconf.org/blob/master/2016/images/logo-sample.png Variant 2: https://raw.githubusercontent.com/p0nce/dconf.org/4f0f2b5be8ec2b06e3feb01d6472ec13a7be4e7c/2016/images/logo2-sample.png 2) by Jonas Drewsen: https://dl.dropboxusercontent.com/u/188292/g4421.png 3) by anonymous: PNG: http://imgur.com/GX0HUFI SVG: https://gist.github.com/anonymous/4ef7282dfec9ab327084 Thanks, Andrei 3
why to (not) support "older" compiler versions
i have seen many PR's and also Forum entries that deal with the problem of newer features of the compiler not being able and then patching or working around that to support older compiler versions. since it is really easy to keep up with compiler versions and even switch (and not many features are being removed from dmd) what are good reasons to keep backward compatiblity? the latest example i saw was replacing groupBy by a loop to keep compatiblity with 2.066. while not a big thing, it adds up. since still a lot of useful features do get added into phobos at a fairly fast pace, would it not be better to to keep targeting just the two most recent versions and moving the ecosystem a little bit further. For people entering the world of D it would be much more encouraging to read a lot of concise code using all the nice features we have instead of just lipstick'd C.
Re: why to (not) support "older" compiler versions
On Tuesday, 3 November 2015 at 08:22:37 UTC, Johannes Pfau wrote: I guess it's to be compatible with the latest DMD, LDC and GDC. GDC currently only provides the 2.066.1 frontend. this makes sense. unfortunately often it happens that i pull in one or the other library that just happens not to work on ldc or gdc and its over my head to fix it => stuck with dmd. i like you'r "crazy idea", i think the ecosystem could greatly benefit from tackling this problem at its root.
Re: LuaD: creating a flexible data filter system
many thanks for the valuable insights. so far i made a simple prototype with LuaD and classes, works nicely for when my niput what so far is not 100% clear is if there is a way to have a parsed msgpack or json documents being exposed in my lua code in a way so it behaves like a lua object. Ideally in a RW fashion so that changed then again can be processed by D code.
LuaD: creating a flexible data filter system
hi, i'm reading in a stream of data that is deserialized into individual frames. a frame is either of: a) a specific D datastructure ( struct with a few ulong,string,string[string] etc members), known at compile time b) json (preferably stdx.data.json) i now want to implement something where i can dynamically add lua filters that then get data out of these frames, create a new lua object send it back to D code where its either sent to another lua filter or at last being serialized again to json und then being processed further. ideally i would not like to copy all the data into a lua object but directly access it from lua. is there an elegant approach to do this and support both a and b cases? so far i did some benchmarks, mainly with string comparisons and it turned out that luaD is about 10x faster than mruby and python D bridges.
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: [...] check https://github.com/yannick/vibe-aws it has v4 implemented
Re: "if sting in string"
On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, because, the exception should be "Something wrong" ?!? But, thanks for the answers, realy good and the code has been smaller. the question is if there is a way to handle inaccessible directories with dirEntries. the problem is that if you have a directory with insufficent access rights it throws a FileException
how does vibe's PrivateAccessProxy work
can someone explain a bit how the @before hooks works in detail, i mainly have problems understanding why ensureAuth in belows example refers to SampleService. as an instance: https://github.com/rejectedsoftware/vibe.d/blob/a1efc05c09135ca8aca21ccec72790ddfaca67c9/examples/web/source/app.d#L114 so how does PrivateAccessProxy work: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/internal/meta/funcattr.d#L225
Re: most elegant functional way to make a histogram
On Friday, 21 August 2015 at 21:08:25 UTC, Laeeth Isharc wrote: I guess this kind of thing will do: upRangeHighs.each!((ref a)=(++histogram[a][0])); int[] arr = [5,1,2,2,3,4,5,5,5]; int[int] histo; arr.each!( a = ++histo[a] ); writeln(histo); this works
Re: Presentation Intro to D: What works?
On Wednesday, 19 August 2015 at 20:15:48 UTC, qznc wrote: On Thursday, 25 June 2015 at 12:39:11 UTC, qznc wrote: If you are interested in my slides: http://beza1e1.tuxen.de/stuff/FunctionalD.odp http://beza1e1.tuxen.de/stuff/FunctionalD.pdf I spent some time on D history and philosophy. Mostly frontpage stuff. Then I defined what Functional Programming is imho. Showed D's functional features. Then I also talked about Design by Introspection or in my talk Where typeclasses fail. Finished with D advertisement. i like these slides a lot, has the talk been recorded?
Re: Programming in D paper book is available for purchase
On Wednesday, 19 August 2015 at 07:57:17 UTC, Daniel Kozák wrote: V Tue, 18 Aug 2015 17:57:31 -0700 Ali Çehreli via Digitalmars-d-announce digitalmars-d-announce@puremagic.com napsáno: Ali Sometimes I hate I am from Czech Republic. I must wait whole week until this awesome book will be delivered :). congrats ali and thank you a lot for all the effort you did! hope it arrives before i go on vacation :)
Re: std.net.curl
On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that helps. Error: unrecognized switch '-lcurl' do you use dub? if so, did you add libs: [curl] to your dub.json? if that doesn't help, please post the output of curl-config. e.g. curl-config --libs --built-shared --prefix --static-libs
dub and subpackages
i'm trying to have my own versions of my dependencies as git submodules. problem: i include a local version of vibe.d and then i add other local versions of packages that themselves include vibe.d somehow my version of vibe isn't picked up by the other dependencies and it results in an error: Sub package vibe-d: doesn't exist. when i go and simply remove the vibe-d dependency from the dub.json it compiles fine. but that can't be the solution. dub --version DUB version 0.9.24-rc.2+18-g4fece3c, built on Aug 14 2015 top level project uses dub.sdl, subpackages use dub.json. whats the correct way of having a chain of packages included from git submodules so that every packages get's only picked once?
Re: dub and subpackages
On Friday, 14 August 2015 at 08:09:18 UTC, Edwin van Leeuwen wrote: On Friday, 14 August 2015 at 08:06:15 UTC, yawniek wrote: dub add-local allows you to add local copy of a package. This will be system wide though, not only for the current package. i actually tried this, somehow did't work
format of trace.log
is there a reason the trace log is a bit weirdly formatted? a) different tables within one file b) column separation is something like (fill with space until it exceeds 7 digits could this be improved to use a standard format (e.g. tsv) or are there some legacy reasons? also it would be nice to automatically pipe it trough ddemange if that is available. speaking of ddemangle, would it be possible to support lambda functions?
zlib performance
hi, unpacking files is kinda slow, probably i'm doing something wrong. below code is about half the speed of gnu zcat on my os x machine. why? why do i need to .dup the buffer? can i get rid of the casts? the chunk size has only a marginal influence. https://github.com/yannick/zcatd import std.zlib, std.file, std.stdio; void main(string[] args) { auto f = File(args[1], r); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (ubyte[] buffer; f.byChunk(4096)) { auto uncompressed = cast(immutable(string)) uncompressor.uncompress(buffer.dup); write(uncompressed); } }
Re: zlib performance
On Friday, 7 August 2015 at 08:50:11 UTC, Daniel Kozák wrote: ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user 0.67s system 78% cpu 4.529 total i can now reproduce the results and indeed, its faster than zcat: on a c4.xlarge aws instance running archlinux and dmd v2.067 same file as above on my macbook. best run: 2.72s user 0.39s system 99% cpu 3.134 total worst run: 3.47s user 0.46s system 99% cpu 3.970 total zcat: best: 4.45s user 0.28s system 99% cpu 4.764 total worst: 4.99s user 0.57s system 99% cpu 5.568 total so i guess on os x there is still something to be optimized
Re: zlib performance
On Friday, 7 August 2015 at 07:29:15 UTC, Daniel Kozák wrote: Which compiler and version. There has been some performance problem with IO on OSX, it should be fixed in 2.068 release i'm on master. v2.068-devel-8f81ffc also changed file read mode to rb. i don't understand why the program crashes when i do not do the .dup
Re: zlib performance
On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: i don't understand why the program crashes when i do not do the .dup This is weird. I would say it should not crash exactely. but try it yourself. the fastest version i could come up so far is below. std.conv slows it down. going from a 4kb to a 4mb buffer helped. now i'm within 30% of gzcat's performance. import std.zlib, std.file, std.stdio; void main(string[] args) { auto f = File(args[1], rb); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (ubyte[] buffer; f.byChunk(1024*1024*4)) { auto uncompressed = cast(immutable(string)) uncompressor.uncompress(buffer.dup); write(uncompressed); } }
Re: zlib performance
On Friday, 7 August 2015 at 07:48:25 UTC, yawniek wrote: On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: the fastest version i could come up so far is below. std.conv slows it down. going from a 4kb to a 4mb buffer helped. now i'm within 30% of gzcat's performance. ok maybe not, there is another problem, not everything seems to get flushed, i'm missing output
Re: zlib performance
On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote: import std.zlib, std.file, std.stdio, std.conv; void main(string[] args) { auto f = File(args[1], rb); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (buffer; f.byChunk(4096)) { auto uncompressed = cast(char[])(uncompressor.uncompress(buffer.idup)); write(uncompressed); } write(cast(char[])uncompressor.flush); } this is faster for me than zcat not here on os x: d version: 3.06s user 1.17s system 82% cpu 5.156 total gzcat 1.79s user 0.11s system 99% cpu 1.899 total
Re: zlib performance
On Friday, 7 August 2015 at 08:24:11 UTC, Daniel Kozák wrote: can you try it with ldc? ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user 0.67s system 78% cpu 4.529 total (different file, half the size of the one above:) archlinux, virtualbox vm, DMD64 D Compiler v2.067 real0m2.079s user0m1.193s sys 0m0.637s zcat: real0m3.023s user0m0.320s sys 0m2.440s is there a way to get rid of the flush in the end so everything happens in one loop? its a bit inconvenient when i have another subloop that does work
Re: zlib performance
On Friday, 7 August 2015 at 11:45:00 UTC, Daniel Kozak wrote: On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote: [...] Can you try it without write operation (comment out all write)? And than try it without uncompression? // without compression: void main(string[] args) { auto f = File(args[1], r); foreach (buffer; f.byChunk(4096)) { write(cast(char[])buffer); } } 0.03s user 0.09s system 11% cpu 1.046 total // without write: void main(string[] args) { auto f = File(args[1], r); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (buffer; f.byChunk(4096)) { auto uncompressed = cast(char[])(uncompressor.uncompress(buffer)); } uncompressor.flush; } 2.82s user 0.05s system 99% cpu 2.873 total
Re: DUB RC 0.9.24-rc.1 ready for testing
On Tuesday, 21 July 2015 at 13:17:36 UTC, Andrei Alexandrescu wrote: At the first D meetup in the Silicon Valley, Vic (an accomplished entrepreneur who has been following up D'd path) discussed some ideas for improving D's adoption. He mentioned some other languages have improved adoption by means of a strong application (e.g. Rails for Ruby) and suggested we make vibe.d, which is one of D's most compelling publicly available applications, more prominent among D's toolchain. He mentioned that many folks start with the high-level need (I need a web framework) and accept the language as an artifact. great point, i was one of these people. my requirements where simple: - needs to be ultrafast - needs to produce binary - bonus: nice language, many libraries. in the end it was GO (many libs, shitty lang) vs. D (not so many libs, great lang,faster) but i don't think bundling vibe will help. bundling dub will be enough. you just do dub init -t vibe.d and you're set. plus you will hopefully have the latest stable version automatically. imho the following stuff is missing/could be done to lower the barrier of entry (some have been mentioned already): general language: - join the forums. create a place to discuss vibe that has some traffic already. - ability to add code snippets/comments to the documentation (this was php's way to success back in the days). A risky strategy because of the trash,but maybe worth thinking about vibe: - a cool example project (e.g. a clone of hackernews similar to lobste.rs. ) - include/document (postgres)sql database access (ddb?) nice to haves: - plugin system with generators e.g. for Users, Authorization etc. - some live compile/reload loop for development (via shared libs?) - same for release. how do i deploy a new version without loosing requests (as for me, i currently just use nginx)
Re: D for project in computational chemistry
On Sunday, 2 August 2015 at 16:25:18 UTC, Yura wrote: While it is easy to code in Python there are two things I do not like: 1) Python is slow for nested loops (much slower comparing to C) 2) Python is not compiled. However, I want to work with a code which can be compiled and distributed as binaries (at least at the beginning). you can use the best of both worlds with pyd: https://github.com/ariovistus/pyd - write python Modules in D and/or - make your D code scriptable with python
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 14:17:34 UTC, Sebastiaan Koppe wrote: On Wednesday, 29 July 2015 at 07:30:50 UTC, yawniek wrote: In times of reactive frameworks it makes no sense anymore to render html in the backend. Nowadays with the many client-side dom manipulations it is tempting to just do it all in the client. But in terms of speed it also makes sense to do an initial render on the server, and only render the delta's on the client. On Wednesday, 29 July 2015 at 07:30:50 UTC, yawniek wrote: backends/services should concentrate on data transformations (and security etc). Yeah, it makes it easier for frontend development to transform data into a nice structure. in my opinion also the REST style apis will come to an end as we can easily have stateless apis these days ( 86.62%of browsers have websockets already according to http://caniuse.com/#feat=websockets ). Was a big fan of REST - but since it is hard to aggregate requests, you end up making too many - so am looking for alternatives. When you say stateful, what exactly do you want to keep between requests? The whole ghetto around maintaining state over http for a web application is nuts if you think about how native applications work. Care to elaborate? check how volt or meteor work e.g. https://www.youtube.com/watch?v=P27EPQ4ne7o the idea is that you don't to the whole MVC pattern twice. the controler or similar objects reside on the server side, reacting on events from both, backends AND frontend/views to then act and push data out to be rendered. aka the data from the backend will not be transformed[0] again within the client prior to being consumed by the rendering logic. [0] meaning that there is no datatype specific code or other code that can't be hidden away in a generic framework. you may transform it from msgpack/protobuf to javascript object etc..
Re: extern(C) with function returning user type
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote: How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I can't create my D obj file so I can't really get there. I know that there htod but, is there anyway I can avoid using that? I'm using GDC, and GCC on Win7 checkout dstep https://github.com/jacob-carlborg/dstep i think you can just define a struct with the same shape. see also mike's answer on http://forum.dlang.org/post/yheamworbhcaprrko...@forum.dlang.org
Re: D Web Services Application Potential?
On Monday, 27 July 2015 at 06:10:29 UTC, Sebastiaan Koppe wrote: For instance, for rendering pages I would rather front the D backend with some (stateless) node app that fetches the data from the D backend and uses something like React to render server/client side. If the D backend could implement the upcoming GraphQL that would be awesome. It has the benefit that a) the frontend-end devs still get their familiar language, tools and libraries; and b) that all the real stuff happens in D. this is absolutely the way to go. In times of reactive frameworks it makes no sense anymore to render html in the backend. backends/services should concentrate on data transformations (and security etc). in my opinion also the REST style apis will come to an end as we can easily have stateless apis these days ( 86.62%of browsers have websockets already according to http://caniuse.com/#feat=websockets ). The whole ghetto around maintaining state over http for a web application is nuts if you think about how native applications work. so the whole discussion about servlets is a bit moot or at least its very backward looking. while its probably a few years too early to see frameworks that _push_ webassembly to the client, we already see frameworks where javascript (or stuff that then compiles into it) is being pushed out. voltframework.com looks quite interesting. bottom line: in my opinion it will be hard to convince java style web programmers to switch to d. it might be a better strategy to build frameworks that can be used as solid, fast and stateful backends for apps and especially for games.
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 09:22:44 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 29 July 2015 at 07:30:50 UTC, yawniek wrote: in my opinion also the REST style apis will come to an end as we can easily have stateless apis these days ( 86.62%of browsers have websockets already according to http://caniuse.com/#feat=websockets ). The whole ghetto around maintaining state over http for a web application is nuts if you think about how native applications work. But REST is supposed to be stateless! You maintain state in the client and use the server like a database/information service. Most applications are better off with REST and SPDY as the main transport. Websockets are of limited usefulness, and only for auxillary information (e.g. pushing notifications about updates). It's only a TCP connection where the server can initiate communication. sorry typo. i meant we now can have statefull apis. and i disagree on the limited usefulness. do you have REST api in native apps? i don't see much reason why we should not develop web applications the way we develop native apps.