问题
What is the experience with LightSpeed? The comparison provided by Mindscape doesn't say too much about NHibernate. Lightspeed seems flexible, but I don't see much about performance. How well does Lightspeed perform? Also are there any drawbacks to using Lightspeed?
回答1:
Over the past six months, I've been using NHibernate with Active Record at work, and LightSpeed at home in my spare time.
Advantages / Drawbacks So far, I've found both LightSpeed and NHibernate with Active Record to be straightforward to learn.
I haven't found drawbacks with LightSpeed (yet). The features I like most are:
- Convention over configuration. This saves a lot of time and provides consistent code.
- The model class and config generator.
- Support for Linq and MySQL 5.
The features I like most about Active Record are:
- No XML configuration required, the most common configuration options are provided automatically.
- NHibernate's flexibility is still available when required (e.g. criteria queries).
The drawbacks of Active Record for me are:
- There appear to be more Ruby on Rails code examples than C# examples
Performance I haven't (yet) compared both products side by side and run performance tests on both equally.
I would guess that NHibernate suffers from a deeper class hierarchy. While optimising my code using ANTS Profiler, I found that for a simple query there is call after call through NHibernate classes before the actual SQL query is produced.
Of course, it's the query that is produced that will make all the difference to the ultimate performance of the ORM.
Both LightSpeed and NHibernate offer lazy loading, and Active Record makes this easy for NHibernate.
I think it is easier to optimise your queries using Lightspeed with Linq, and more clear to people maintaining your code. Whereas it's not usually recommended to write NHibernate HQL.
回答2:
On performance, from this page
Eager & lazy loading No N+1 problem. Includes "named aggregates." That is, giving a name to particular eager load graph. Watch the screencast.
Dont underestimate this. This means if you load a list of 200 items, MOST ORM's will run 201 queries in a lot of cases. Lightspeed doesn't. It's one of the (very) few that dont.
If you are looking for something which is a few 100ms quicker in a few edge cases, good luck benchmarking stuff. I like NH in theory, and I dont think I'd ever NOT use an ORM, but for most of what I've done, NH is total overkill - I end up spending so much time maintaining the meta data, class files, mappings et al, and it's ... interesting ... to test. well, it was for us, anyway.
回答3:
I recently took a quick look at both. What impressed me with Lightspeed is:
- Their tools which work very well (best VS designers I've ever used, I think).
- Very fast responses. They answered questions and added features.
What was a showstopper for me was that they heavily rely on conventions, and there doesn't seem to be overrides in most cases. So my options when it comes to deciding exactly how things get mapped were not as good as I wanted. Supposedly Lightspeed 3 will address this to allow you to do more customization.
I stayed away from NHibernate because of all the XML, but then found Fluent NHibernate and it looks like it'll work out pretty well. There's no designer support, although some might say that's by design (focus on your objects). NHibernate also seems to be the most used ORM for .NET so it's a "safe" bet in that sense. So far it's been able to map most of what I can come up with.
At any rate, I didn't get very far with Lightspeed because of the customization limitations. If I was starting a fresh project that could conform to their conventions, it might be a different story. The company is so responsive, I would really like to use one of their products :).
回答4:
I did comparison of a large set of ORMs recently, including NH and Lightspeed. I use NH professionally so I'm a bit biased, the article is here.
回答5:
I've been using Lightspeed for a few months, but I'm a newbie in .NET, so have never used NHibernate. Up to now I have found it pretty easy to use with a small learning curve and it is constantly being updated. The big plus for me is the support.Queries usually get answered within a very short space of time and any bugs found are often fixed by the following day and available in the nightly build. Not sure what you mean by "how well Lightspeed performs" ? This guy seems pretty happy {:o) http://omarbesiso.spaces.live.com/blog/cns!70A5B53D721071B7!473.entry
回答6:
I had a chat to one of the lead developers of this product (Jeremy Boyd) at last years TechEd in Auckland NZ, and asked this very question. He seemed to think that it was several orders of magnitude faster than NHibernate. It's his product of course so he's going to say that, but I thought it worth mentioning.
来源:https://stackoverflow.com/questions/732105/lightspeed-vs-nhibernate