Camelia, the Perl 6 bug

IRC log for #mojo, 2013-01-23

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:01 marty joined #mojo
00:05 jzawodn joined #mojo
00:05 Miked joined #mojo
00:12 Molaf_ joined #mojo
00:22 atz__ joined #mojo
00:22 hesperaux joined #mojo
00:27 noganex joined #mojo
00:28 vervain joined #mojo
00:43 TitanOfO1d joined #mojo
01:00 Molaf__ joined #mojo
01:00 egopro joined #mojo
01:03 shmuel joined #mojo
01:05 ka2u joined #mojo
01:08 Mike-PerlRecruiter_ joined #mojo
01:11 hlin joined #mojo
01:39 jberger sri: would you have any interest in adding BUILD/BUILDARGS support to Mojo::Base? Its not much code and my guess is that it would reduce the total number of lines of code in Mojolicious
01:40 sri jberger: what's the performance cost?
01:40 jberger shouldn't be too much, I could time the test base both ways
01:41 jberger I haven't actually made a branch of mojo with it yet
01:41 jberger it was something I found myself needing in a project so I made a subclass of Mojo::Base
01:41 jberger http://pastie.org/5827908
01:42 jberger its next to zero hit if you don't use BUILD
01:43 jberger and if you do, I would guess the hit goes as the size of the inheritance tree
01:43 jberger (thats my suspicion at least anyway)
01:45 jberger http://pastie.org/5827914
01:45 jberger sorry the first one was slightly mangled
01:45 jberger and mro is core since 5.9.5
01:49 sri jberger: performance regression is massive
01:49 jberger seriously?
01:49 sri just testing the http stack it is already 2400 rps vs 2800 rps
01:50 jberger well I wouldn't have you do it then
01:50 jberger that has to be the one call to BUILDARGS
01:50 jberger thats surprising though
01:50 jberger oh well
01:51 sri if you want to profile the http stack, examples/fast.pl is pretty good, leaves out the mojolicious layer
01:53 jberger ok, well I will look at it a little more on this end
01:53 jberger but I'm not sure that it could be streamlined any more than that, so non-starter I guess
01:54 sri for tests it is 50.88 vs 51.40 CPU
01:54 sri that's more than adding unicode normalization to Mojo::Util::decode :)
01:54 jberger haha
01:55 sri about twice as much
01:55 d4rkie joined #mojo
01:55 jberger well the only thing that might still help it would be changing all the `sub new {` in the codebase to `sub BUILD`
01:55 jberger but I doubt it will make up that much (if any)
01:55 jberger so nevermind
01:55 jberger I did rather grow fond of the normalization idea though
01:56 sri automatic normalization makes no sense imo
01:56 sri we can't know what the developer wants
01:56 jberger I suppose thats true, even if its probably what they want most of the time
01:57 sri considering some normalized forms break like 40 unit tests and are horribly slow, i'm not sure about that ;p
01:59 sri jberger: btw. the hit from BUILDARGS alone is massive
01:59 jberger I guess its twice the number of method calls on instantiation
01:59 sri down to 2600 rps
01:59 jberger every time
01:59 jberger yeah ick
02:00 * sri wishes method calls were cheaper in perl
02:00 jberger I guess it makes sense actually, for the number of object that are created on each request, that adds up
02:00 jberger objects
02:01 jberger is it the lookup or the dispatch?
02:01 jberger if the lookup is cheap enough, I might be able to remove some of the hit
02:07 xaka joined #mojo
02:07 sri just calling ->can('BUILD') seems to cost
02:07 jberger how do you do the rps test?
02:07 jberger is there a handy tool?
02:08 sri for naive a/b tests "perl -Ilib examples/fast.pl prefork -l http://*:8080 -m production" and "ab -B 127.0.0.1 -n 10000 -c 100 -k http://127.0.0.1:8080/"
02:10 sri for stress testing the I/O stack i use "perl -Ilib examples/microhttpd.pl"
02:11 sri and for a full stack hello world test "perl -Ilib examples/hello.pl prefork -l http://*:8080 -m production"
02:12 sri for real profiling of course NYTProf with all of those apps
02:14 jberger ok I installed ab
02:14 jberger I'm getting a warning that -B is not a valid option
02:15 jberger what is that flag supposed to do?
02:16 jberger for now I just removed it
02:16 jberger wanna know what crappy hardware I'm using?
02:17 jberger on the master branch fast.pl gives me  342.70 rps
02:17 jberger hahaha
02:20 jberger so I can't use this to profile, since my branch then only has 345.88 rps
02:20 D4RK-PH0ENiX joined #mojo
02:24 ka2u joined #mojo
02:28 vervain joined #mojo
02:32 d4rkie joined #mojo
02:33 jberger not going to help I don't think, but this is probably the minimum new {} : http://pastie.org/5828034
02:33 jberger no dispatch unless needed
02:33 jberger still need two ->can calls
02:34 jberger which can't be removed by definition
02:41 sri jberger: that version costs about 150 rps
02:41 sri btw. i'm testing on my macbook air
02:41 jberger hey I'm working it down :D
02:41 jberger dell mini 10
02:43 sri just adding ->can('BUILD') seems to cost about 100 rps
02:44 sri naah, not that bad actually, closer to 50 rps
02:52 sri jberger: http://pastie.org/5828075 # then just copy the old ->new() to ->old() :)
02:53 sri to make it a little more scientific
02:53 sri new:  3 wallclock secs ( 2.03 usr +  0.00 sys =  2.03 CPU) @ 492610.84/s (n=1000000)
02:53 mussur joined #mojo
02:53 sri old:  1 wallclock secs ( 1.22 usr +  0.00 sys =  1.22 CPU) @ 819672.13/s (n=1000000)
02:54 jberger good idea
02:54 sri and that's only adding $class->can('BUILD') to ->new()
02:54 jberger I have a few more ideas
02:54 jberger but again, probably not going to make that up
02:55 sri i don't see how you could avoid the lookup
02:57 sri this stuff should so be in core.... and optimized to hell
03:01 jberger agreed
03:01 jberger I've optimized the latter stuff, but yeah, can't do anything about the lookups
03:06 jberger and don't get a dell mini 10
03:06 jberger my tests are running like 14 s vs 6 s
03:06 * jberger faceplant
03:11 sri ouch
03:11 * sri hugs his macbook air
03:13 zivester joined #mojo
03:15 jberger on the plus side I got it for free (promotional) and its been the longest lasting laptop I've had
03:15 jberger I usually burn them up, I think this one isn't powerful enough for that to be a concern
03:16 mattastrophe joined #mojo
03:16 * tempire is eyeing the dell xps one
03:19 sri dell is like... almost dead
03:20 sri http://www.bloomberg.com/news/2013-0​1-22/dell-said-to-near-buyout-as-mic​rosoft-discusses-deal-financing.html
03:20 sri you could be buying a microsoft laptop basically ;p
03:28 jberger I will probably buy an unbranded powerbeast for my next one
03:29 jberger (not really unbranded, prebranded. They are all made in asia then rebranded)
03:29 jberger http://www.xoticpc.com/
03:31 jberger or elsewhere
03:31 * jberger hates paying for windows
03:31 * jberger hates expensive frisbees
03:31 jberger (do they even give you a disk anymore? probably not
03:32 jberger ) ----> that was bothering me (sorry)
03:34 noganex joined #mojo
03:59 D4RK-PH0ENiX joined #mojo
04:06 russum joined #mojo
04:21 mattastrophe joined #mojo
04:22 tempire I don't know.  Have you seen the cnet review?  Even if dell dies, the xps one looks really solid.
04:22 tempire Apple stuff is looking really stale these days.
04:23 tempire Jonny Ive, save us all.
04:40 d4rkie joined #mojo
04:54 ka2u joined #mojo
05:47 fhelmber_ joined #mojo
05:51 jnbek joined #mojo
06:04 jnbek joined #mojo
06:21 Vandal joined #mojo
06:25 spleenjack joined #mojo
06:37 ver joined #mojo
06:49 dod joined #mojo
06:53 yakudza joined #mojo
06:54 dod1 joined #mojo
07:07 dpetrov_ joined #mojo
07:20 taryk joined #mojo
07:24 taryk` joined #mojo
07:25 dod joined #mojo
07:29 taryk left #mojo
07:33 Averna joined #mojo
07:40 rem_lex|pivo joined #mojo
07:57 rhaen_fork joined #mojo
07:58 arpadszasz joined #mojo
08:04 ulric joined #mojo
08:08 suy joined #mojo
08:14 ka2u joined #mojo
08:18 arpadszasz joined #mojo
08:26 dpetrov_ joined #mojo
08:31 alnewkirk joined #mojo
08:32 jontaylor joined #mojo
08:50 Miked joined #mojo
08:52 ObseLeTe joined #mojo
09:12 dotan joined #mojo
10:33 ryozi joined #mojo
10:45 mussur joined #mojo
11:00 xaka joined #mojo
11:24 dotan1 joined #mojo
11:25 vervain joined #mojo
11:36 egopro joined #mojo
11:37 arpadszasz joined #mojo
12:02 warlock joined #mojo
12:03 warlock hi, im trying to get this chat example to work (the second one) https://github.com/kraih/mojo/wiki/Writi​ng-websocket-chat-using-Mojolicious-Lite - but it seems that I dont have the js/ws.js javascript file thats on the client-side code, does anyone know where I can get it?
12:03 warlock oh, go figure - it's just below. duh!
12:12 ObseLeTe joined #mojo
12:20 TitanOfOld joined #mojo
12:31 zivester joined #mojo
12:41 arpadszasz joined #mojo
12:53 Miked joined #mojo
13:11 Mike-PerlRecruiter_ joined #mojo
14:07 sh4 joined #mojo
14:11 sivoais joined #mojo
14:12 stephanj i got a few models(DB; maintenance stuff) which need the application to work(db initialization plugin stuff etc), what would be the best way to make sure i can access the main Mojolicious app from these Models?
14:13 stephanj one way could bee to hand a app object to each time the model needs one as function arg, but surely there are better ways or?
14:16 gryphon joined #mojo
14:21 bluescreen joined #mojo
14:21 vervain stephanj: If it were me I'd just be passing the Models the minimum that they need to work.  If they need more then they may not really be models any more.
14:22 vervain and in fact I've gone for the style of having my models manage the db connection rather than the mojo app.
14:26 d4rkie joined #mojo
14:26 stephanj vervain: i got a plugin managing the db connection, the models in this case are doing the db logic(querying and providing an api to work on the resulted sets), in this case i would like to have the model(it shouldnt be used standalone without a instantiated mojo app anyway...) get config from the app and using a plugin the app loaded to retrieve infos from a webservice(would have to reimplement the functionality in my models otherwhise)
14:28 vervain stephanj: Then it sounds like you want something like a Model base class?  Perhaps you could design it based on how ::Controller works?
14:28 vervain Or just instantiate your model objects and pass them the app on construction?
14:28 ulric left #mojo
14:28 nic stephanj: you don't want the controller to pull the cfg and pass that to the model?
14:29 stephanj would also be possible
14:29 vervain nic++
14:30 bluescreen joined #mojo
14:31 spleenjack joined #mojo
14:51 ka2u joined #mojo
15:06 Molaf joined #mojo
15:09 TitanOfOld joined #mojo
15:13 mattastrophe joined #mojo
15:17 Britzel joined #mojo
15:37 inokenty joined #mojo
15:38 ka2u joined #mojo
15:46 yakudza joined #mojo
15:47 labrown joined #mojo
15:53 mattastrophe joined #mojo
16:03 ObseLeTe joined #mojo
16:10 ruz hi, which method can I override in controller to act before all render_<template> methods?
16:14 marty ruz: http://search.cpan.org/~sri/Mojoli​cious-3.82/lib/Mojolicious.pm#hook
16:19 sri we once had a before_render hook, but it was removed since nobody could come up with a good use case for it
16:22 ruz marty, sri: I don't see a suitable hook there and hoped for a method to do different things depending on controller
16:25 marty ruz:  Sorry, I missed that you needed it before render.  I do not think we currently have a suitable hook at this time.  If you can supply a good use case I think the core devs might consider adding it.
16:26 rhaen_fork joined #mojo
16:28 ruz marty: I want common entry point in the controller to setup stash for any template and then continue with render_xxx
16:29 ruz at this moment I have such method and it converts scalars in the stash into objects
16:31 sri hook wouldn't work for that anyway
16:32 ruz sri: well hoook can work, you can call "pre_render" method on the controller from the hook
16:33 sri ruz: that would be pretty ugly, we don't do ugly ;)
16:33 sri requirement for adding a new hook is two good use cases btw.
16:34 ruz sri: now I'm trying the following: dispatch everything to render_page action with page key in the stage indicating real action
16:35 sri that's all application logic, it does not belong in hooks imo
16:35 sri hooks are for general purpose extensions of the framework
16:35 ruz render_page does the magic, moves page in the stash into action position and calls render
16:35 ruz yes, it doesn't belong
16:36 ruz I expected render to call render_<template> method, but it doesn't
16:36 arpadszasz joined #mojo
16:39 ka2u joined #mojo
16:39 sri next on my list of potential new hooks to add is before_routes btw., semantics are still unclear, so ideas for good use cases would be very welcome :)
16:40 sri if it runs between route matching and route dispatching it could be used to preprocess captures (like unicode normalization), or to rewrite the dispatch stack ($self->match->stack)
16:44 ruz sri: here is what I ended with and it works, but ugly: http://pastie.org/5838252
16:46 ruz to make it less ugly I could override a method in controller that does "transfor stash into template_<action> call", but it's not there
16:58 arpadszasz joined #mojo
17:09 xaka joined #mojo
17:14 ka2u joined #mojo
17:40 ka2u joined #mojo
17:44 al802 joined #mojo
17:52 trone_ joined #mojo
18:00 dpetrov_ joined #mojo
18:07 yakudza joined #mojo
18:12 basic6 joined #mojo
18:32 sri oh, textmate2 is making progress again \o/
18:56 xaka joined #mojo
19:06 atz__ joined #mojo
19:26 marcus sri: great progress
19:26 marcus <3 cmd-t improvements
19:43 sri new github code search looks nice too! https://github.com/search?q=%22Mojo%3A%3AIOLoop-%​3Etimer%28%22&amp;type=Code&amp;ref=searchresults
19:43 ObseLeTe joined #mojo
19:53 marcus sri: agree!
19:54 marcus And it searches in all my private projects as well, sexy time.
20:06 sri \o\
20:06 sri /o/
20:10 marcus sri: glad you applied the url_for speedup from nicomen.. My project manager says I'm to blame for any problems with mojo :)
20:11 * sri blames marcus
20:11 * marcus blames tempire
20:11 * tempire blames crab's lack of avatar
20:12 sri tempire: FAIL! https://github.com/amenonsen
20:12 * sri blames tempire too now
20:12 tempire oh snap
20:12 * marcus was waiting for crab to blame sri.
20:12 tempire crab++++
20:12 marcus crab has a super avatar.
20:13 marcus "When you open files without extension nor identifying content (like a shebang) then they now open as plain text (instead of asking you to pick a type)" <- <3 this TM2 change.
20:15 TitanOfOld joined #mojo
20:19 al802 I have an ssl cert from AlphaSSL, the root cert is Globalsign, is there a way I can add an intermediate certificate to mojo,e.g. listen with  "https://*:443?cert=/etc/server.crt&key=​/etc/server.key&ca=/etc/globalsign.crt".
20:21 sri i think you have to set verify=... to something for it to work, but i've never done it
20:22 al802 Cool, I will try it
20:25 tempire what are the command-t improvements?
20:25 tempire I switched to ctrl-p long ago
20:25 sri tm2
20:26 sri command-t was originally a textmate feature before it made its way to vim
20:28 sri and it's getting smarter
20:28 sri (and more pretty of course)
20:31 marcus soon to have switch between uncommitted changes
20:31 marcus and it's fricking fast. I have a huge ~/Source/ it indexes it very quickly
20:32 * sri didn't expect to love git support in textmate so much
20:33 marcus tempire: https://www.evernote.com/shard/s22/sh/1638c81e-928​e-4b44-8e8c-b0ca017b26df/7cc4816fae0f5e7fb90679cc9​807783e/deep/0/Fullscreen%2023.01.13%2021:32.jpg this is how cmd-t looks in tm2 now
20:34 marcus and you can do alt-enter to open and close other open files, which great when you've been working on something and start on something else.
20:35 sri think i saw in the changes somewhere that you should be able to jump to symbols soo too with foo@bar or so
20:35 sri *soon
20:36 lukep joined #mojo
20:37 sri ah, you can go to line with :23, like in sublime text
20:38 marcus yeah
20:53 marcus hmm
20:57 al802 FYI: verify= did not work, so I appended the intermediate.crt to my site /etc/server.crt it now works.
21:06 jnbek joined #mojo
21:21 BeDa joined #mojo
21:28 xaka joined #mojo
21:56 tm1 joined #mojo
22:14 xaka joined #mojo
22:17 tm joined #mojo
22:25 tm guys, I have a design question - generic, no code written yet
22:26 tm what is the best approach to manage sessions, ie I want to ensure that only users with valid session and specific rights can load listed pages?
22:27 tm simple case - homepate, help, contact - allow unauth access, all others in application need auth
22:29 tm so far I did it in one project as before_dispatch hook to check session state and update expiry on every app hit
22:29 tm but I'm sure someone must have done it already :D
22:30 tm and smarter than I did it
22:31 Britzel TIMTOWTDI. I use a bridge to generate routes which require auth, and I use M::P::Authentication. The session cookie just stores a user id which I use to look up more data in a store (database). Especuially the last point is a matter of personal preference and size o data.
22:32 marty tm:  are you aware of the Mojolicious Auth plugin:   http://search.cpan.org/~madcat/Mojoli​cious-Plugin-Authentication-1.24/lib/​Mojolicious/Plugin/Authentication.pm
22:34 tm marty: I am and don't remember why I didn't use it
22:35 tm Britzel: thanks for the idea!
22:36 tm marty: that will be actually the best approach I guess, no more stupid code of my own, just custom coderefs for user validation and lookup
22:36 tm thank you
22:39 al joined #mojo
23:18 Miked joined #mojo
23:24 dotan joined #mojo
23:41 anaio joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary