ben
2019-10-4 15:01:03

I had a funny experience editing a raw PDF today …


sorawee
2019-10-4 15:01:44

I thought it’s a binary file…


ben
2019-10-4 15:02:59

I had a pdf from 2017 and I wanted to add a title to it. So I opened it in Vim, found the empty \Title() metadata, and put a title between the parentheses. After, I could open the pdf in chrome just fine … but Adobe Reader said it was corrupted. So, then, I deleted characters from other metadata fields to make up for the title. Then it worked in other editors.


ben
2019-10-4 15:03:24

Does anyone know what else I could have changed to add a \Title?


sorawee
2019-10-4 15:42:46
$ racket a.rkt
cpu time: 2517 real time: 32886 gc time: 107
$ racket
> (dynamic-require '(file "a.rkt") #f)
cpu time: 2596 real time: 17451 gc time: 178
> ^D
$ racket a.rkt
cpu time: 2550 real time: 32856 gc time: 112
$ racket
> (dynamic-require '(file "a.rkt") #f)
cpu time: 2617 real time: 17565 gc time: 103
> ^D

How is this possible?!?


laurent.orseau
2019-10-4 15:44:11

Why is the real time much larger than cpu time? Some sleep or something?


sorawee
2019-10-4 15:45:13

I think these are time spent on external processes


sorawee
2019-10-4 15:45:48

But they should be the same whether it’s invoked by dynamic-require or directly, no?


laurent.orseau
2019-10-4 15:47:13

just guessing here: maybe dynamic-require organizes runtime a little differently, allowing some subprocesses to wait a shorter amount of time before actually running?


sorawee
2019-10-4 15:48:43

Could be…


mflatt
2019-10-4 15:54:16

Is there a main submodule (that does something like running an external process)? Providing “a.rkt” on the command line will run main, but dynamic-require will not.


laurent.orseau
2019-10-4 15:55:30

aha!


sorawee
2019-10-4 16:03:37

But there’s no main submodule…


blerner
2019-10-4 16:04:45

There’s a “directory” at the end of the file that tells the reader where to find key file features, in terms of character offsets. You’d need to edit that to be consistent


sorawee
2019-10-4 16:07:12

@mflatt Oh, the file where the program spent most time on is a compiled file (starts with #~). Could this be the cause?


sorawee
2019-10-4 16:10:23

It’s really weird. I measured the execution time of a.rkt when a.rkt is NOT a compiled file. It used to take ~30s (whether or not I use dynamic-require or racket directly). Then, I changed it to a compiled file, and see the behavior I described above. Then, I switched back to non-compiled file, and now both dynamic-require and racket takes only 17s. (But switching back to compiled file still gives the same behavior)


gfb
2019-10-4 19:03:43

my packages have the same problem


gfb
2019-10-4 19:06:28

building wasn’t necessary before (is it now?) in order to point to the updated package and have raco pkg update fetch it