首页 \ 问答 \ ASP.NET MVC性能(ASP.NET MVC Performance)

ASP.NET MVC性能(ASP.NET MVC Performance)

我发现一些野蛮言论,ASP.NET MVC比ASP.NET WebForms快30倍。 什么真正的性能差异在哪里,这是衡量和什么是性能优势。

这是为了帮助我考虑从ASP.NET WebForms移植到ASP.NET MVC。


I found some wild remarks that ASP.NET MVC is 30x faster than ASP.NET WebForms. What real performance difference is there, has this been measured and what are the performance benefits.

This is to help me consider moving from ASP.NET WebForms to ASP.NET MVC.


原文:https://stackoverflow.com/questions/43743
更新时间:2021-09-02 20:09

最满意答案

#include <boost/thread/tss.hpp>
static boost::thread_specific_ptr< MyClass> instance;
if( ! instance.get() ) {
    // first time called by this thread
    // construct test element to be used in all subsequent calls from this thread
    instance.reset( new MyClass);
}
    instance->doSomething();

#include <boost/thread/tss.hpp>
static boost::thread_specific_ptr< MyClass> instance;
if( ! instance.get() ) {
    // first time called by this thread
    // construct test element to be used in all subsequent calls from this thread
    instance.reset( new MyClass);
}
    instance->doSomething();

相关问答

更多
  • 速度取决于TLS的实施。 是的,TLS可以像查找指针一样快,这是正确的。 具有内存管理单元的系统甚至可以更快。 对于指针查找,您需要调度程序的帮助。 调度程序必须 - 在任务开关上 - 更新指向TLS数据的指针。 实现TLS的另一种快速方法是通过内存管理单元。 这里的TLS被视为与任何其他数据一样,除了TLS变量分配在一个特殊的段中。 调度程序将在任务切换时将正确的内存块映射到任务的地址空间。 如果调度程序不支持任何这些方法,则编译器/库必须执行以下操作: 获取当前的ThreadId 采取信号量 通过Thr ...
  • #include static boost::thread_specific_ptr< MyClass> instance; if( ! instance.get() ) { // first time called by this thread // construct test element to be used in all subsequent calls from this thread instance.reset( new ...
  • 在Python中,所有东西都是共享的,除了函数局部变量(因为每个函数调用获得自己的一组本地线程,线程总是单独的函数调用)。即使这样,只有变量本身(引用对象的名称)是功能的本地; 对象本身总是全局的,任何东西都可以引用它们。 在这方面,特定线程的Thread对象不是特殊对象。 如果您将Thread对象存储在所有线程都可以访问的位置(如全局变量),则所有线程都可以访问该Thread对象。 如果你想原子地修改你不是在这个相同的线程中创建的任何东西 ,并且没有其他线程可以在任何地方存储,你必须通过锁来保护它。 所有 ...
  • Thread.new do Thread.current[:foo]="bar" t1=Thread.new(Thread.current) do |parent| puts parent[:foo] ? parent[:foo] : 'nothing' end.join end.join #=> bar 更新: 在irb中尝试这个: thread_ext.rb class Thread def self.another_new(*args) parent = Th ...
  • 我相信这个页面只是一个Apple标准GCC手册上的样式表。 在Mac OS X中注意.so而不是.dylib 。 所以Mac上的gcc完全有可能不支持__thread 。 您需要手动使用pthread_setspecific 。 ( 此问题已作为错误提交 。) I believe that page is just an Apple stylesheet slapped on the standard GCC manual. Notice the .so instead of .dylib in Mac O ...
  • 函数的局部变量对于运行该函数的每个线程都是唯一的。 这可以在TLS的帮助下完成,正如已经提到的那样,每个线程都是本地的。 如果你想在线程之间共享一些数据,有几个选择从使用全局或静态变量到内存映射文件等等。如果你需要在线程之间共享数据,还要检查线程同步。 下图说明了TLS的工作原理。 有关更多信息,请查看MSDN 。 替代文字http://i.msdn.microsoft.com/dynimg/IC495837.png The local variables of a function are unique ...
  • 您不应该将ThreadLocal与并行任务一起使用,如果您有需要处理的资源,除非您在创建对象时跟踪创建的对象,否则很难自行清理。 这是因为在ThreadPool上创建了任务,因此无法保证再次返回同一个线程来执行清理工作1 。 处理此问题的更好方法是使用Parallel.For或Parallel.ForEach ,它接收lambda,该lambda创建一个与任务绑定的对象,并且一次只能由一个线程使用(名为localInit和localFinally )。 Parallel.ForEach(GetSomeDat ...
  • 在MSDN上阅读本文 ,文章中有示例代码的链接。 Read this on MSDN, there is a link to example code in the article.
  • 在这种情况下,您使用线程本地存储是安全的。 没有两个线程将共享相同的本地存储(因此它的线程本地)。 因此,两个并发请求不会踩踏其他数据。 几个其他评论虽然 请避免使用Thread.Abort 。 这是一个非常危险的操作,在这里真的不需要。 线程将在之后结束语句。 更好的方法是创建一个包含UserId作为本地字段的后台操作的类。 每个请求都会获得一个新的类实例。 这是将数据传递给后台任务的更简单方法 In this case your use of thread local storage is safe. ...
  • TLS在每个线程对象中实现为数据数组。 每个线程对象都有自己的数组本地副本,每个数组的大小相同。 当您将全局/静态变量声明为使用TLS时,它与这些数组的索引相关联(这就是编译器/操作系统知道要分配多少个数组插槽的方式)。 因此,当您在运行时访问变量时,您实际上是访问正在访问变量的线程上下文的数据数组中的关联槽。 TLS可能是C ++ 11中的一个新的本机功能,但它已经在各种OS API中提供了很长时间。 TLS在Windows上使用Win32 API TlsAlloc() , TlsGetValue() , ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)