Hacker News new | past | comments | ask | show | jobs | submit | elsamuko's comments login

Sea squirts digest their own brain when they become stationary: https://scopeblog.stanford.edu/2022/07/20/what-can-sea-squir...


Any parallels to sedentary human beings are strictly coincidental.


A question: Would it be possible to pass the stacktrace of the current thread to another, so that the stacktrace would be traceable across threadpools or worker threads?


I am not sure if i understand the question correctly. But once collected, stack traces are just regular object that can be passed around thread as other object. It's possible that some implementation have references to some stack addresses (like for example the address of a function parameter), in which case you would need to serialize the stack trace before storing them/ moving then another thread.


> once collected, stack traces are just regular object that can be passed around thread as other object.

> It's possible that some implementation have references to some stack addresses (like for example the address of a function parameter), in which case you would need to serialize the stack trace before storing them/ moving then another thread.

So which of these two mutually exclusive options is it? As I understand it, that was the question.


> So which of these two mutually exclusive options is it? As I understand it, that was the question.

Well the stack_entry/stack_trace object can be moved around between thread, as in the object itself is copyable and movable. However, the handle_type is implementation defined, so it might be the case that extracting the information out of the object only works on the producing thread.


As far as I understand, basic_stack trace is just a container of stacktrace_entries, which are Regular types. So the default distinct-objects type safety rules apply.

You should be able to, for example, collect the stacktace on one thread, transport it to another and print it.


When I debug multithreaded programs, the stacktrace of a breakpoint usually ends somewhere in a worker thread. What I want is that the worker thread's stacktrace part is replaced by the one who put the work into it. Kinda like the program wasn't multithreaded at all.


Ah. I guess you can capture the stack trace at task creation point, then stitch together a new stack trace by replacing the generic common prefix of your worker thread trace with the task creation one.

But you can't use the basic_stacktrace container itself as it is immutable and not constructibe from a range, so you have to roll your own. You should be able to use the stacktrace_entries though.

Most importantly, I expect that capturing a stacktrace is quite expensive, so you might not be able to do it at task creation time, and it is too late to do it later. Maybe you want this only in debug mode.

Note I haven't actually tried any if this, it is just guesswork.


Exactly this. I didn't try this, and I suppose that some low level pointer rewriting would be necessary to do this. I'm not sure if it's expensive though, maybe you can replace the pointers without resolving the stacktrace.


The problem is that to get the stacktrace of the task creation you have to traverse the stack at that point in time. You can't really do it later. And stack traversal using DWARF unwind info, for example, is neither cheap nor simple. You might have better luck if you compile with frame pointer though.


I think what you looking for is "task tracing" not really stack tracing. The relationship between the task (like where was a task added in the thread pool) are not reflected in the stacktrace the way you want them. To address those, you need to have special handshake between the debugger and your task api. You can also instrument the "add_task" function call to log every time a task is added to you queue and do some some offline stack stiching.


if you actually wanted to you could probably wrap thread to pass the stacktrace of the spawning thread into the worker thread whenever you spawn a thread and then output that upon a crash as well. the library seems pretty simple and flexible.


That's a paradox.

See also https://xkcd.com/552/


> paradox

It technically isn't, because it's not an "Epimenides" - the poster is not asking to be believed, but just encouraging.

It is not that ¬B(¬B(x)) would promote a truth value of x.


Technically, you don't know if it might be a paradox, because you don't know if I personally know OP or not. Except, I don't know OP, so I can't know that you don't know--hell, you might even be OP.


It'll be a success or a good story.


This one is a beautiful phrase before starting something scary.


Depends on who is telling the story; a eulogy could be a good story.


Take social dancing lessons like Salsa, Bachata, Kizomba. These are very fun! But have a proper personal hygiene, some figures are very close.


For the cryptopals challenge, you have to invert the Mersenne Twister scramble function:

https://cryptopals.com/sets/3/challenges/23

https://github.com/elsamuko/cryptopals/blob/610ab19bf6823a34...


I was searching for a DisplayPort adapter for a Mac Mini and got MiniDisplayPort adapters for Mac :(


So the better search would be "DisplayPort adapter for a Mac."

As with including the word "stripes" in a search where you want to omit results with stripes, including the word "mini" is only causing unnecessary confusion. The adapter that works for a Mac Mini will also work for a Macbook, as an example.


I'm currently working on a searcher on my own: https://github.com/elsamuko/fsrc

When I started, I didn't know ripgrep, now I use it as reference. Of course it's still slower for regex searches and it has less options, but in some cases (e.g. simple string matching search), it is faster than rg (PM_RESUME in 160-170ms), mostly thanks to mischasan's fast strstr: https://mischasan.wordpress.com/2011/07/16/convergence-sse2-...

If you want, let me know, what you think about it.


I don't see any build instructions, so I don't know how to try it. Sorry. I did run `./scripts/build_boost.sh`, but that didn't produce any `fsrc` binary that I could use.

I would also caution you to make sure you're benchmarking equivalent workloads.


There are no build instructions yet, you need to build boost with build_boost.sh and then open qmake/fsrc.pro with Qt Creator. There are binaries available here, too: https://github.com/elsamuko/fsrc/releases

And I know than benchmarking is hard, a coarse comparison is in scripts/compare.sh. More detailed performance tests are in test/TestPerformance.


I don't know what Qt Creator is. Please provide tools to build your code from the command line.

I did some playing around with your binary, but it's pretty hard to benchmark because I don't know what your tool is doing with respect to .gitignore, hidden files and binary files. Your output format is also non-standard and doesn't revert to a line-by-line format when piped into another tool, so it's exceptionally difficult to determine whether the match counts are correct. Either way, I don't see any evidence that fsrc is faster. That you're using a fast SIMD algorithm is somewhat irrelevant; ripgrep uses SIMD too.

On my copy of the Linux checkout (note the `-u` flags passed to ripgrep):

    $ time /tmp/fsrc PM_RESUME | wc -l
    41

    real    0.143
    user    0.330
    sys     0.474
    maxmem  67 MB
    faults  0

    $ time rg -uuu PM_RESUME | wc -l
    17

    real    0.149
    user    0.564
    sys     0.690
    maxmem  13 MB
    faults  0

    $ time rg -uu PM_RESUME | wc -l
    17

    real    0.112
    user    0.481
    sys     0.675
    maxmem  13 MB
    faults  0

    $ time rg -u PM_RESUME | wc -l
    17

    real    0.118
    user    0.507
    sys     0.701
    maxmem  13 MB
    faults  0

    $ time rg PM_RESUME | wc -l
    17

    real    0.142
    user    0.749
    sys     0.726
    maxmem  21 MB
    faults  0
I originally tried to run `fsrc` on a single file (in order to better control the benchmark), but I got an error:

    $ time /tmp/fsrc 'Sherlock Holmes' /data/benchsuite/subtitles/2018/OpenSubtitles2018.raw.sample.en
    Error  : option '--term' cannot be specified more than once
    Usage  : fsrc [options] term
    Options:
      -h [ --help ]         Help
      -d [ --dir ] arg      Search folder
      -i [ --ignore-case ]  Case insensitive search
      -r [ --regex ]        Regex search (slower)
      --no-git              Disable search with 'git ls-files'
      --no-colors           Disable colorized output
      -q [ --quiet ]        only print status


    Build : v0.9 from Jul  5 2019
    Web   : https://github.com/elsamuko/fsrc

    real    0.005
    user    0.002
    sys     0.002
    maxmem  9 MB
    faults  0


I included qmake and added a `deploy.sh` in the main source folder, which generates the deployed zip file. Let me know, if this doesn't build.

  * gitignore behaviour: If there is a .git folder in the search folder, it uses git ls-files to get all files to search in
  * a .git folder itself is never searched
  * hidden folders and files are searched
  * binaries are ['detected'](https://github.com/elsamuko/fsrc/blob/f1e29a3e24e5dbe87908c4ca84775116f39f8cfe/src/utils.cpp#L93), if they contain two binary 0's within the first 100 bytes or are PDF or PostScript files.
  * pipe behaviour is not implemented yet
  * it supports only one option-less argument as search term
  * folders are set with -d


I'm using

  cygstart --action=runas
This works well, too.


Yeah, I'm never going to remember that one...


Maybe this will help? :)

alias sudo="cygstart --action=runas"


I have a pi2 with smb, etherpad lite, prosody and sshd and it uses 170 MB after two weeks uptime.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: