Is publishing a journal article covering failed attempts a good idea? I am currently doing some research on an algorithm that may (or may not) end up being slower than other similar algorithms. The idea behind it seems solid although it will probably not be as fast as other, already known and used solutions. Finishing and testing is of course part of the science, so the research will get carried out nevertheless.

So here is my question: is writing an article about conducted, but failed work a good thing?

My thoughts are that publishing such an article would help people conducting similar research, who would otherwise waste their own time, trying to do the same thing. Saving their time is crucial for the scientific community in my personal opinion, but I am unsure how others perceive the same problem and I do not want others to have negative opinion about my work.

There are many similar questions on this site, but none seem to duplicate this exact one. This question, for instance, covers confirming or denying others research carried out and described elsewhere, while I am talking strictly about inventing and disproving the idea myself. Many other talk about the rationale behind not posting negative results, but that's also a slightly different subject (although undoubtedly related).
In order to give your work sufficient rigour and novelty for publication, you might need to set out the theoretical basis for why you thought your new algorithm would be quicker; and an analysis of why, despite that theoretical underpinning, it was not quicker: i.e. how did reality interfere with the theory?

In theory, the test for whether or not it's a good idea to publish failed attempts, is: would it help other researchers advance? In practice, even if it did, you might struggle to find a journal that considered it of sufficient interest to be worth publishing.

Some fields do now have a journal of negative results, which could be a suitable venue. That seems, for now, to be mostly restricted to fields within the life sciences, which might not be your field.

So you might want to consider going to one of the new mega-journals, which select only on the basis of whether your work is methodologically sound and on-topic, and whether you've paid their publishing fee.

And now you can see one risk there: you've got to be careful to avoid predatory publishers.

Another, less obvious risk, is that given some megajournals have incredibly wide scope (e.g. "science"), they are not always able to get suitable peer-reviewers: so your work could appear alongside some really shoddy work, leaving readers doubting the quality of your work, even if the journal is widely held to be non-predatory.