Hacker Newsnew | past | comments | ask | show | jobs | submit | maxidog's commentslogin

Did you check MiMo correctly performed this unfamiliar task before posting this comment?


I did. I read the code to make sure the quality of MiMo's work matched mine for a quick experiment, though not that the code was free from subtle bugs.

This was the main change for bzip2:

  @@ -33,19 +34,16 @@ def candidate_lengths(
       level: int = 9,
       pool: ThreadPoolExecutor | None = None,
   ) -> list[int]:
  -    """Compressed length of ``context + seq`` for each seq, sharing the context.
  +    """Compressed length of ``context + seq`` for each seq.
  
  -    Compresses ``context`` once into a ``compressobj``, then clones its encoder
  -    state per candidate and feeds only that candidate. Identical to
  -    ``len(zlib.compress(context + seq, level))`` for each seq, but the expensive
  -    match search over ``context`` happens a single time.
  +    Unlike ``zlib``'s ``compressobj``, Python's ``BZ2Compressor`` cannot be
  +    snapshotted mid-stream, and bzip2's move-to-front + Huffman stages see the
  +    whole block, so every candidate recompresses the full context. Threads
  +    still scale because ``bz2`` releases the GIL.
       """
  -    base = zlib.compressobj(level)
  -    head = len(base.compress(context))
  
       def length_for(seq: bytes) -> int:
  -        clone = base.copy()
  -        return head + len(clone.compress(seq) + clone.flush(zlib.Z_FINISH))
  +        return len(bz2.compress(context + seq, level))
  
       if pool is not None:
           return list(pool.map(length_for, sequences))


Is the fact that the original did [compress base]+[compress seq] rather than [compress [bytes + seq]] not important?

(I honestly don’t know is gzip does something different when presented with two chunks as opposed to one, or, if it does, if bz2 has equivalent behaviour - but the difference in the code did stand out to me, and it does seem related to ‘extending the token sequence’)


This difference doesn't matter because of how zlib works. At least by default, zlib divides the input data into its own blocks independent of the caller. If you don't feed it enough data to complete a block, it waits until you feed it more or finish the stream.

We can test it by going back to zlib:

       def length_for(seq: bytes) -> int:
  -        return len(bz2.compress(context + seq, level))
  +        return len(zlib.compress(context + seq, level))
At temperature zero, this outputs the same sample as commit 3734bf6, the most recent commit upstream:

  MENENIUS:
  'Though all at once cannq

  MARCIUS:
  I'll fight
  'Though all at once cannq

  MARCIUannq
  
  MARCIUS:
  I'll fight
  'Though
  
  AUFIDIUS:
  If I fly, Marci
  
  AUFIDIUS:
  If I fly, Marci
  
  AUFID
  
  AUFIDIUS:
  If
  If I fly
I also tried LZMA for good measure:

       def length_for(seq: bytes) -> int:
  -        return len(bz2.compress(context + seq, level))
  +        return len(lzma.compress(context + seq))
The sample at temperature zero:

  MENENIUS:
  'Th
  
  A carbuncle enti
  
  , as big as thou
  
  
  A aa
This is followed by a lot of whitespace.

python-lz4 gives you all newlines after the prompt. I tried debugging it, and the compressed length of different candidate seqs is the same.


I have no idea what this means but I love it!


I’m currently reverse engineering a large enterprise app and the feature flag bloat is truly astounding. Imho excessive feature flag complexity is a symptom of management who are indecisive and mistrusted by the developers.


You need to be actively deleting them after the feature has gone live


i could see it getting complex with a lot of flags, inevitable you'll run into a situation where more than one flag is combined.

something like enabledFeature = (flag1 || flag2 || flag3) && flag4

then, down the road, you remove flag4. Hopefully the above would result in a compile error but you may be in a language or situation where a missing flag4 is interpreted as boolean false. That could cause all kinds of havoc in logical combinations like that are scattered all over the codebase. Even worse would be REST APIs retrieving flag values because who knows what's happening in that service code? Plus, you'd never know there was an issue until users start reporting missing or extra features showing up unless you have e2e tests for every possible combination of feature flags...


Surely the commenter means deleting them in the code, not just the management software. Otherwise, what's the point?

You need to find every occurrence of flag4 and remove references to it. So that boolean expression would need to have `&& flag4` removed.


What I’m saying is there may be references you don’t have access to.


Create story to add feature flag controlling access to the feature.

Immediately create story to remove said feature flag controlling access to the feature and review it during backlog refinements.


> Imho excessive feature flag complexity is a symptom of management who are indecisive and mistrusted by the developers.

In my experience, engineers aren't using them to account for managerial dithering, they're doing it for safe deployments and experiments and rollouts and such. A product with millions of users can easily have a tens or even hundreds of active switches at any moment (I'm assuming a large engineering team behind said product), and that's not necessarily a bad thing.

However, as someone else noted here, you absolutely MUST delete and clean up your flags/gates/whatever when you've completed that effort. That part can be tricky because not everyone has the discipline to pay off tech debt.

Usually, a flag/gate should not live in code for more than a few months. If it does, it should have robust justification.


This of course depends on the quantity and the depth of these feature flags. It’s ok to hard code few of them, maybe it’s not when it becomes a practice and you have tens of them. I think you would have a much easier life if there was a standardized, well documented, way to define them.


I studied “computation” at Oxford 92-95 while CAR Hoare was still there and basically all they taught us about computers were these formal methods. They actually thought it would revolutionise programming and looked down at anything else as “hand-waving”. Think the syllabus was abandoned only a few years later thank goodness.


Interesting to hear your experience. I was there 94–97, when the curriculum was still pretty heavy on formal methods (and functional programming).

For me it was wonderful. I already knew how to write computer programs, as that's what I had spent most of my waking hours doing before that point, but learning how to think rigorously about the correctness of programs was a revelation to me.


I studied "Mathematics and Computation" there in 89-92 because they seemed to think that "computation" was a fad that was probably going away, so you couldn't let people study just "Computation".

There was a certain amount of formal methods, but only in a perfunctory manner, as if to satisfy an inconvenient requirement. Some functional programming, but in an extremely shallow way. Overall, I did not learn a single useful thing in 3 years.

I followed this up with Ph.D. in Computer Science somewhere else, which was also a complete waste of time.


Not a single useful thing? A complete waste of time? Really not anything that you found intriguing or thought-provoking for its own sake? I did the same course nine years later and found it very stimulating, even if it wasn't always directly "applicable" so to speak. But perhaps the syllabus had changed a bit by then.


What I learned from these comments sharing their experiences from one time to another is that the curriculum evolved and no one had the same experience.

Not to mention how individuals perceive things - two students with similar aptitude in the same class can still have their own very different experiences.


Just a heads up.

> I followed this up with Ph.D. in Computer Science somewhere else, which was also a complete waste of time.

It has been shown this form of thinking results in depression.


Thanks, friend. I currently don't have depression, but I'll see if I can work towards that.


Lol, thanks for that, was worried I was being too negative!


Still a strong presence in 98-01 but also lots of functional programming, algorithms and complexity and the tail end of the parallel research boom. I loved it.


Actually it goes straight back to the Apple TV remote without having to unlock. Not sure what the time limit is but it works after the device has gone to sleep and otherwise locked itself.


6% return peak bubble to peak bubble is in no way reassuring.


Am I unusual in being constantly surprised when people assume time's arrow in everyday conversation? I can never quite accept the sheer oddness and asymmetry of it.


Does that mean you are uncomfortable - or whatever I should call it - with the implied time ordering of events like an egg sitting on the table and then falling down and smashing on the floor?


It does sound very unusual to be surprised by that, yes. Although it is understandable that your surprise is constant.


Well done! I'm reminded of an Ani Difranco song that was playing back in my college days: perhaps parent is a goldfish?


Nope, that really was the end of the story.


Is that fundamentally different from http://en.wikipedia.org/wiki/Memory-mapped_file ?


I was just thinking about this the other day. Yes, a memory-mapped-file is different, because the API is still that of a file. The memory mapping is just a behind-the-scenes optimisation.


Only if you want posix compliance across threads and such. If you just want the contents of the file memory mapped nothing stops you from setting up a shared memory segment and mapping it without that filesystem overhead.


Does that work for writes as well? I am not sure if it would work without the OS setting up traps for writes to the pages or explicit flush calls from the app. In the former case, it would be very inefficient, and in the latter, it wouldn't be a clean write-and-forget system.


Yes, it works for writes and support is built-in to current processors. It's faster than conventional file access.


Especially weird considering the hack is totally unnecessary. You can take a picture without making a shutter sound using AVFoundation.


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

Search: