
I had a funny experience editing a raw PDF today …

I thought it’s a binary file…

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.

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

$ 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?!?

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

I think these are time spent on external processes

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

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

Could be…

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.

aha!

But there’s no main
submodule…

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

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

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)

my packages have the same problem

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