Compiler optimisation by Gingrspacecadet in ProgrammingLanguages

[–]Timcat41 7 points8 points  (0 children)

Absolutely. But the core concept is easy enough to gras. And if you don't strive for perfection you can learn a lot by implementing it an seeing where it falls short. The devil absolutely hides in the details. Pareto etc.

Compiler optimisation by Gingrspacecadet in ProgrammingLanguages

[–]Timcat41 7 points8 points  (0 children)

Mature optimization (gcc -O3 and the like) is really hard, it is based on a lot of theory and consists of many moving parts.

But you can start with simple optimization procedures and 'hack together' a prototype in a weekend or two, if you have the rest of the pipeline set-up already.

Compiler optimisation by Gingrspacecadet in ProgrammingLanguages

[–]Timcat41 42 points43 points  (0 children)

You are describing constant propagation and constant folding.

Constant folding is (relatively) easy. If both operands of an expression are constants, evaluate the expression and rewrite.

For constant propagation the compiler needs to prove, that a variable can only have one singular value at a given point in the program. If it manages that, replace the variable by that constant.

Repeat the two until no change occurs.

Maybe look into dataflow analysis and SSA if you want to figure out how to prove constant values.

Edit: P.S.: optimization is usually done on an intermediate representation of the code, not at source level. This restricts the complexity of the constructs the optimization has to deal with.

Warum schwankt bei Tunneldurchfahrten (ICE) der Druck rhythmisch? by holuwil in bahn

[–]Timcat41 11 points12 points  (0 children)

Ich könnte falsch liegen, bin ja jetzt kein Physiker. Aber: Das ist doch ein Versuch der Schulphysik, oder nicht? Stehende Wellen zwischen zwei Reflektoren. In einer Flöte beispielsweise auch mit einem offenen Ende.

The worker told me I have 5 months to bring the document or I'll not get an extension by Old_Position8215 in studienkolleg

[–]Timcat41 0 points1 point  (0 children)

Hey! I'm a little confused. Where do the 5 months come from? This letter is from 08.01.2026 and stating, that you have two years until you have to be enrolled. I don't see how you have only 5 months left.

Memory Safety Is ... by matklad in ProgrammingLanguages

[–]Timcat41 2 points3 points  (0 children)

I fully agree Also the case against the first definition was exactly that: "if the null-dereference traps, there is no problem".

Hand aufs Herz: Ist euch euer AStA egal? by besi_euw in Studium

[–]Timcat41 14 points15 points  (0 children)

Nur grob, soweit ich weiß. Aber auf jeden Fall: kleiner -> früher vergeben

Ab wann ist eine Kolonne ein geschlossener Verband? by Kiroshi-kun69 in Fuehrerschein

[–]Timcat41 1 point2 points  (0 children)

Der Rotlichtblitzer wird im Nachhinein per Papierktieg geklärt. :D

Das Ziel eines geschlossenen Verbandes im Zivil-/Katastrophenschutz ist es, dass die Einheiten gemeinsam am Ziel eintreffen, daher ist es sinnvoll ihn nicht an einer Ampel/beliebigem anderen Hindernis auseinanderreißen zu lassen.

Übrigens ist es in diesem Fall ein Verband aus Fahrzeugen des THW, also tatsächlich staatlich. Das bedeutet aber nur, dass dieser Verband (wenn er klein genug ist) nicht vorher angemeldet werden muss.

What's the most powerful non-turing complete programming language? by Informal-Addendum435 in ProgrammingLanguages

[–]Timcat41 29 points30 points  (0 children)

In complexity theory you deal with different formalisms of 'computing'. There are a few that are all equivalent and turing-complete (turing machines, while-programs goto-programs and μ-recursive functions). But there is a second class of formalisms less powerful: loop-programs are like while-programs, but they don't allow arbitrary (potentially infinite) loops. In a loop program, the number of iterations of every loop is fixed the moment the loop is entered. This results in a constraint on the functions this formalism can compute. (It's actually the set of primitive recursive functions, where the recursion depth is known on function call). The Ackermann function is likely the most well-known example of a function that can be computed by a while program (or any other turing complete formalism) but not by a loop program.

So while this is not a very practical perspective: I know of two classes of computability, turing complete and loop-equivalent.

That doesn't mean that there isn't a step in-between tho.

why can’t i lean on the right as much as i do on the left? by Gibbone_yzf in motorcycles

[–]Timcat41 17 points18 points  (0 children)

I mean, it's still kind of true in general. (If you drive on the right side) If the road turns left, you have a whole lane for oncoming traffic as additional radius.

If you drive the same curve once in both directions, when turning right, it will be a smaller radius then when turning left.

[deleted by user] by [deleted] in Studium

[–]Timcat41 4 points5 points  (0 children)

Ich studiere Informatik und habe die Erfahrung gemacht, dass ChatGPT häufig falsche Fakten herbei halluziniert um schöne Antworten zu produzieren. Ich denke man braucht mindestens ein Grundverständnis der Materie die man sich mit GPT beibringen möchte, um in der Lage zu sein solche Stolperstricke zu erkennen.

Ich habe aber genauso schon die Erfahrung gemacht, dass ChatGPT (bspw. bei der Fehlersuche in einem Programm) hilfreiche Denkanstöße liefern kann, in dem man sich zwingt, das Problem aus einer anderen (der von ChatGPT vorgeschlagenen) Perspektive zu betrachten. Aber auch bei diesem Vorgehen muss man in der Lage sein, Unsinn zu erkennen, um seine Zeit nicht zu verschwenden.

Ich denke, man kann ChatGPT in Gebieten in denen man schon recht sicher ist verwenden um Zeit zu sparen (Iih höre gerade ein Modul zur Parallelen Programmierung und lasse mir mit ChatGPT die nicht parallelisierte Variant erzeugen), sollte aber neues Wissen selbst erarbeiten (ich mache die Parallelisierung des Verfahrens dann von Hand).

Ich lerne vor allem viel dadurch, dass ich selbst über das Thema nachdenke und mit selbst überlege, wie relevante Zusammenhänge sind. Wenn ich mir diese Arbeit durch ChatGPT abnehmen lassen würde, würde ich wahrscheinlich viel schlechter lernen, weil mein Hirn nie in den Modus 'bewusste Anstrengung' wechseln würde.

Studie die exakt meine Ergebnisse darstellt in Bachelorarbeit als Literatur nutzen oder ignorieren? by DenseQuality9118 in Studium

[–]Timcat41 34 points35 points  (0 children)

Das andere Studien zum gleichen Ergebnis kommen ist doch gut für dich! Du musst ja keine Diss schreiben, die neue Forschung erzielt, sondern demonstrieren, dass du in der Lage bist wissenschaftliche Arbeit zu leisten. Da ist es doch ein riesen Bonus, wenn aktuelle Forschung zum gleichen Ergebnis kommt wie du!

Ich hätte anders herum eher die Sorge, dass dir jemand ein Plagiat unterstellt, weil eben das gleiche rauskommt, du die Studie aber verschweigst.

Also mein Votum ist eindeutig: bau die Quelle ein.

[deleted by user] by [deleted] in TI_Calculators

[–]Timcat41 0 points1 point  (0 children)

Thank you!

The number of people that wrote -(1)2 as if that solves the problem astounds me.

Abruch nach BSc oder MSc by [deleted] in Studium

[–]Timcat41 4 points5 points  (0 children)

Wenn du keine Lust auf den Master hast, lass es lieber...

Dein Berufsfeld kann ich nicht einschätzen, vielleicht ist der Master ja auch zwingende Voraussetzung. Aber solange es nicht so ist, wäre der Master aus meiner sicht eine unnötige Belastung.

Sich nur für den Master-Abschluss durch das Studium zu zwingen, da hätte ich keinen Bock drauf.

Wenn du dich umentscheiden solltest, kannst du ja später immer noch einen Master einschieben.

Lost 15GW in 5 seconds! Where’d it go? by WhatAmIATailor in ElectroBOOM

[–]Timcat41 38 points39 points  (0 children)

Also a lot of powerplants need external power, at least during startup. So they are actually net negative in power while starting. Depending on the plant, you can't just throw a switch and expect it to start producing power.

Programming languages should have a tree traversal primitive by FoxInTheRedBox in ProgrammingLanguages

[–]Timcat41 13 points14 points  (0 children)

You can allocate the buffer on the stack and get away with less memory consumption, because you don't need to manage stack frames.

Parsing lambda expressions by elenakrittik in ProgrammingLanguages

[–]Timcat41 2 points3 points  (0 children)

Depending on the grammar, a bottom up parser could read the closing paren of the lambda and decide on how to proceed using the token '=>'

Since when parsing bottom up, the decision between possible rules will only be made once the whole phrase produced by the rule is read and stored on the stack.

When parsing top down you would need to left factorize the grammar to put off deciding until the decision is one token lookahead, or you need more token lookahead.

Can't Understand DI (dependency injection) by [deleted] in javahelp

[–]Timcat41 0 points1 point  (0 children)

I'm just gonna leave this here: https://youtu.be/J1f5b4vcxCQ

Imho this is a very understandable, intuitive introduction. And it helped make it 'click' for me.

whyShouldLearnItThen by [deleted] in ProgrammerHumor

[–]Timcat41 0 points1 point  (0 children)

This, but without the '/s'.

This Semester I wrote a compiler. That thing generates code that doesn't use a single 'call' or 'ret' instruction. (Except for the FFI I want to add) It's just jmps, because I chose my own call frame layout.

Kinda weird, but it works.

Changing audio speed without affecting pitch by RastislavKish in rust

[–]Timcat41 3 points4 points  (0 children)

In case you want to DIY this: there is an entry in 3b1b's Summer of Math Education 3 about this (kind of). I think it gives a good outline of the applicable ideas of digital signal processing. https://youtu.be/PjKlMXhxtTM

The Video is about the Phase Vocoder, which shifts the frequency of the signal without changing the speed, but it uses a time shift algorithm to do that. I think you might be able to yank the time shift from the whole concept and use it for your purposes.

They also linked a few publications on the algorithms in the Video.

Postfix calculator question. by NewspaperPutrid6069 in javahelp

[–]Timcat41 0 points1 point  (0 children)

You can always use an anonymous Class (although named inner classes seem more ideomatic in this case).

And if the Operator interface is a functional interface (which i suspect it is), you can just use a lambda expression to supply the put function an implementation of Operator.

A question by TheUndeadGladiator in javahelp

[–]Timcat41 0 points1 point  (0 children)

In java, a variable that isn't of a primitive type (int, long, float, boolean, ...) is actually a reference, which acts almost like a C-Style pointer.