Log of #mupdf at irc.freenode.net.

Search:
 <<<Back 1 day (to 2018/04/26)20180427 
laertus i'm getting this error: "mupdf: source/fitz/colorspace.c:1399: fast_rgb_to_cmyk: Assertion `"This should never happen" == NULL' failed."04:13.54 
  when trying to open this file: http://azarted.org/sites/default/files/BarguePlate9-12.pdf04:14.04 
  i'm using mupdf 1.12.0-r2 on amd64 gentoo linux04:14.34 
  also getting the same error when trying to open this file: http://www.davinciinitiative.org/uploads/3/8/6/4/3864305/drawing_with_envelopes.pdf04:17.09 
moolc laertus: works here with git head04:19.35 
laertus hmm04:19.50 
  confirmed04:49.58 
  git head works for me too04:50.02 
  i guess the problem's something to do with the gentoo version04:50.16 
  thanks for your help04:52.51 
avih tor8: do you agree on the sort-is-stringifying-the array issue?08:22.05 
tor8 avih: hang on, let me have a look08:33.40 
  avih: hmm, yes, I see the problem08:34.59 
  the toString call changes the stack slot as a nasty side effect08:35.15 
  so your patch looks correct08:35.25 
avih exactly, which Sp_sort doesn't expect08:35.32 
  yeah08:35.35 
tor8 it's an insert sort08:35.41 
avih well, O(n^2) though. very slow very quickly08:36.08 
tor8 much better than bubble, sometimes worse than quicksort08:36.09 
avih i have a pure js iterative quicksort, and for 1000 items it's ~10x faster than the native sort08:37.31 
  for 10k items the native one is tens of seconds (i aborted), while the js quicksort one is 300ms08:38.33 
tor8 avih: well, I wrote the insert sort because it's easy to implement and I needed to get it done quick.08:41.18 
avih sure. and it works :)08:41.33 
tor8 if you're up to coding up the quicksort in jsarray.c I'll gladly take it on08:41.35 
avih that's my code https://pastebin.mozilla.org/908404208:41.46 
tor8 avih: you can make your own function even faster if you avoid inner functions08:44.16 
  if mujs doesn't need to create a lexical scope with upvalues, then it can compile the functions to 'lightweight' functions which are faster08:44.44 
avih correct, and also create create a stringified array first if not using an external comparator08:44.56 
  this was a proof of concept for comparing to the internal sort. it's not optimized.08:45.39 
  but i wanted to avoid polluting the global object08:46.13 
tor8 avih: if you trigger a 'debugger' statement, the output will list the disassemble of the function which has a 'lightweight' line if the function is compiled to be lightweight08:46.17 
  avih: at least qsort_iterantive and partition are lightweigh08:47.18 
  qsort itself is not08:47.38 
avih tor8: you mean "debugger" is a keyword which mujs understands?08:47.42 
tor8 you could hoist the main body of work into a smaller inner function08:47.52 
  avih: yes. debugger is a standard javascript statement.08:48.02 
avih yeah, it can be optimized a lot. also remove the call to the compare function if no external one is used. it's not optimized08:48.23 
  oh, didn't know about debugger. nice08:48.32 
tor8 it prints the stack contents and a disassembly of all the functions in the call frame08:49.22 
  which also includes all inner functions of the functions and the script in the frame08:49.36 
avih tor8: re lightweight vs non light function, where does the overhead manifest? while calling it? while resolving symbols?08:49.38 
tor8 avih: both when calling it and when accessing local variables08:50.03 
avih do you consider one or both general to js? or is it mujs specific?08:50.32 
tor8 a heavyweight function needs an actual object to hold the local variables (since they can be accessed from the inner functions as upvalues, and need to be saved as part of the lexical scope if a function returns an inner function)08:50.50 
  so when calling a heavyweight function, we need to malloc and fill out an object for the stack frame instead of just using the simple stack08:51.15 
  and local variable accesses turn into dictionary lookups instead of indexing on the simple stack08:51.27 
  "getvar" vs "getlocal" opcodes08:51.37 
  this is mujs specific08:51.54 
avih (sec, reading. admittedly, i haven't tried to understand when a function is/not lightweight)08:52.11 
tor8 basically, if it has inner functions or uses the magic 'arguments' variable it becomes heavyweight08:52.46 
avih in general though, i prefer not optimizing for mujs.08:52.49 
tor8 the inner functions by themselves can be lightweight, it's just the parent function that has variables that need to be saved somewhere off the simple stack08:53.20 
  Math.floor involves looking up a property (Math) in the 'globals' object, then a property (floor) in the math object08:55.08 
  a faster trick if you want to turn something into an integer is ((right + left) / 2) | 008:55.25 
  do a bitwise or with zero08:55.30 
  that will force it to be a 32-bit integer for the bitwise math08:55.41 
  and then the bitwise math is a no-op08:55.55 
  that "trick" is what the asm.js javascript subset uses to annotate variables as being integers08:56.26 
avih yeah, familiar with it. though by far the biggest factor in sort is the number of comparisons08:58.27 
moolc shrugs08:59.03 
tor8 avih: function cmpstr(a, b) { return (a = a+"") > (b = b+"") ? 1 : a == b ? 0 : -1; } might be a bit faster09:01.27 
avih tor8: because it doesn't call a constructor from js code?09:01.59 
tor8 it doesn't need to look up a global property and call it, exactly09:02.17 
avih also, shouldn't it be ""+a rather than a+"" ?09:02.34 
tor8 shouldn't matter, if either left or right side is a string, it becomes a string concatenation09:03.14 
avih a+"" is not necessarily a string, while the spec says that they should be compared as strings09:03.20 
  but if a is 9 and b is 10 your code would say b is bigger, but the spec says b should be considered bigger here09:04.01 
  err.. the spec says a should be considered bigger09:04.25 
tor8 11.6.1 step 709:04.38 
  ""+a and a+"" should be equivalent09:05.11 
avih huh, i thought the second arg is converted to the type of the first where possible09:05.42 
tor8 nope. not that simple :)09:05.51 
avih (just read 11.6.1-7)09:05.53 
tor8 JS is full of nasty surprises09:06.51 
avih at least there's a decent standard. unlike with posix shell :)09:08.02 
moolc avih: HUH?09:08.10 
  avih: posix shell command language is perfectly defined09:08.21 
  it's the implemtnations that are interesting09:08.32 
avih moolc: except where it leaves things undefined09:08.34 
moolc avih: such as?09:08.39 
avih A=foo mycommand09:08.52 
moolc yes?09:09.04 
avih does A remain foo after mycommand executes?09:09.05 
moolc - A=foo echo "A=$A"09:09.56 
  A=09:09.57 
  09:09.57 
  it's not foo even during09:10.01 
avih both depend on what "mycommand" is. whether it's a function or a builtin or a special builtin, and also on implementations09:10.45 
moolc in zsh,bash,mksh,dash09:10.48 
avih it would be foo if you replace echo with /bin/echo09:11.40 
moolc avih: if you want A=foo; echo $a.. do it.. if you want (A=foo; echo $A) do that intead09:11.53 
  avih: no it wont09:12.10 
avih moolc: i wasn't describing an issue i have. i was describing an issue the spec has09:12.18 
moolc - A=foo /bin/echo "A=$A"09:12.19 
  A=09:12.19 
  09:12.19 
tor8 avih: Array.prototype.sort fix on master now09:12.24 
avih tor8: thx09:12.31 
moolc avih: i'm not attacking you, i'm just having issues with the statement that posix doesn't defined shell command language properly09:13.07 
  -d09:13.26 
avih moolc: right, sorry. of course it's not foo because "A=$A" is substituted while the line is parsed and before A is assigned09:13.45 
  i think. anyway, the posix shell command line spec is a hell compared to ecma26209:14.31 
moolc avih: it's rather vague and almost completely useless (once you want something that ought to be expressed by more than 250LOC)09:15.41 
avih moolc: but my original question was whether A stays foo after the command. not during it09:15.52 
moolc add a semicolon and it will09:16.28 
avih you're solving the problem for me, a problem which i don't have.09:16.51 
moolc avih: nope. i'm expanding my horizons.09:17.14 
  having recently converted some PSCL thing from PSCL to bash.. because - 'local'09:17.32 
avih i'm just saying that even idiomatic expression like |A=foo mycommand| can behave differently depending on many factors09:17.47 
  moolc: you might be interested in this then https://github.com/avih/shcmp09:18.46 
moolc avih: checking... you might be completely disinterested in following marvels - http://repo.or.cz/llpp.git/blob/master:/misc/llppac http://repo.or.cz/llpp.git/blob/master:/build.bash09:20.43 
avih moolc: what am i looking at?09:22.21 
moolc avih: a. build system in bash b. automatic anything to pdf converter09:22.58 
  example that shell can be useful09:23.20 
avih funny. i wrote shcmp because i was writing a build system :)09:23.22 
  https://github.com/avih/mpv-build/tree/mpv-build-rewrite09:23.56 
moolc avih: hah :)09:24.06 
  avih: i just switched to bash when lack of local became to painful09:24.18 
  s;to;too09:24.24 
avih yeah, for now mine uses local. i'm considering removing it, but i probably won't. it's too useful09:24.46 
moolc bash is too ubiquitous to ignore...09:25.14 
avih but most shells support local. even yash which at my example shows it doesn't, support it with another command09:25.27 
  for me the shells which should work are dash/bash/busybox-ash and mksh (or bsd /bin/sh which is pretty mush the same)09:26.22 
moolc avih: there are other quarter-pound like small differences that make pscl as opposed to specific implementation to big of pain09:26.25 
avih mksh in general is quite good09:26.28 
moolc avih: it is09:26.44 
  avih: you were/are trying to get rid of waf?09:27.07 
avih no, mpv-build is a higher level. it builds few deps (mostly ffmpeg) which are typically not-latest in your average distro and links mpv statically with them09:28.04 
moolc aha.. gotcha09:28.22 
  i've just expanded my build.sh to build local version of ocaml and build my stuff with that.. so yeah i can understand the pain09:28.51 
  avih: https://groups.google.com/forum/?_escaped_fragment_=msg/shake-build-system/2gQM0YDyDNs/DOKYnkWwCAAJ#!msg/shake-build-system/2gQM0YDyDNs/DOKYnkWwCAAJ09:29.41 
avih moolc: it's actually fully generic and not specific to mpv. the main interface to configure what gets built is user.conf (which overlays default.conf - https://github.com/avih/mpv-build/blob/mpv-build-rewrite/config/default.conf )09:30.03 
  the original mpv-build was mpv-specific, and there are still remains in my rewrite branch which are mpv-specific, but they're not part of the "core" system, like creating the debian package09:30.46 
moolc avih: you are a peculiar man btw.. adding mujs to mpv (when it had/s lua) won't make you friends with tor here... then again mujs is his thing so maybe..09:31.56 
avih i wasn't looking to make friends with tor (though he does seem nice). i was looking to add js to mpv to make its scripting more accessible :)09:33.04 
sebras tor8: the multi-page pnm/tiff-things LGTM.09:33.24 
moolc avih: and place yourself into the world of ""+ vs +"" pain... okay... masochism is not yet punishable universally09:34.21 
sebras tor8: I like "Add pdf_dcit_get_int etc." too, but I'd separate the implementation of those convenience functions from converting code to actually using them.09:34.51 
  because one commit then does something new, and the other is more or less a mechnical replacement.09:35.25 
avih moolc: i tend to use constructs which i understand well, which is unrelated to the fact that admittedly i don't understand everything well.09:35.41 
  the ""+a/a+"" was from his code. in mine i use ""+a (if at all) and i 100% know how it behaves09:36.50 
  moolc: let me know if you find shcmp useful and/or has issues/suggestions with it09:39.44 
  have*09:39.50 
moolc avih: likewise i'd appreciate the testing of repo.or.cz/llpp ;)09:41.09 
avih sure, though i don't have use cases for it (i think? :) )09:41.35 
moolc avih: https://www.youtube.com/watch?v=qNszKpCUXhQ&list=PLLAukRknwSgFhpYsDKHY0oWpvV03Qj4AE ;)09:44.08 
  avih: just ran shells="sh dash bash mksh" ~/x/rcs/git/shcmp/shcmp ~/xsrc/llpp/misc/llppac ~/xsrc/cv/cven.html09:44.36 
  = sh, bash, bash_posix, busybox_ash, dash, mksh, mksh_posix09:44.36 
  no output09:44.40 
tor8 sebras: easy enough to split09:44.51 
moolc to be expected though.. i'm good09:44.54 
avih lol09:45.28 
  moolc: should it print "<empty>" on such case?09:46.05 
moolc the output contained an empty like... not "<empty>" verbatim09:46.38 
avih i understand, which is ok. i'm asking if it should be enhanced to display "<empty>" if there's no output09:47.52 
  it currently prefixes the line with "<error> " if the command exited non-009:48.54 
  e.g. shcmp -c 'blahblah'09:49.59 
moolc that violates one of the unix principles i suppose... but there's much debate lately on those09:50.30 
avih yes, internally the clustering function is 100% pure, but it's called with arguments like prefix to print on error or success (such that you can use its output deterministically in your own code). so the wrapper uses empty prefix for success and <error> for error, and it can be enhanced easily to support an additional input to print if the output is empty.09:54.42 
  the output of the shcmp utility is not designed to be parsable. but the output of the internal cluster_outputs is09:56.23 
  so the core implementation doesn't violate principles i know of. but the utility does diverge from some to make it more useful. if you want, you can wrap the core cluster with your own code.09:59.04 
tor8 sebras: updated commits on tor/master10:01.01 
moolc avih: maybe some other time ;)10:01.13 
avih it was a theoretical suggestion :)10:01.35 
sebras tor8: "Add some comments." LGTM.11:09.02 
tor8 avih: are you maybe confusing the ""+a and a+"" because of the silliness of {}+"" and ""+{} ?12:11.46 
  because those aren't what they look like, due to parser ambiguities12:13.29 
  the first one ({}+"") is not object plus string. it's empty code block statement, followed by unary positive on string)12:14.12 
 Forward 1 day (to 2018/04/28)>>> 
ghostscript.com #ghostscript
Search: