编译F#报价:性能?(Compiling an F# quotation: performance?)
我有一个我操纵的F#引用(我在任何地方添加对象池来回收经常创建和删除的短期对象)。 我想运行结果报价; 现在我已经使用了F#PowerPack,它提供了将引用转换为表达式树的方法,以及我运行的委托。 无法访问生成的代码,我想知道:
- 编译代码的性能如何? 是否有一些未被删除的反射层或者它是真正的编译?
- 我可以看到生成的代码并使用.Net Reflector吗?
谢谢 :)
I have an F# quotation that I manipulate (I add object pools everywhere to recycle short lived objects that get created and deleted very often). I would like to run the resulting quotation; for now I have used the F# PowerPack which offers methods to convert a quotation to an expression tree and the to a delegate, which I run. Having no access to the generated code, I was wondering:
-what is the performance of the compiled code? Is there some layer of reflection that is not removed or is it a true compilation?
- can I see the generated code and use .Net Reflector on it?
thanks :)
原文:https://stackoverflow.com/questions/3529657
最满意答案
有一个UIPickerViewDelegate方法,每次滚动选择器时基本上都会触发该方法
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
设置选择器的委托,实现此方法,看看会发生什么......
[编辑]好了,我现在明白了你的需求。 实现一个计时器,检查选择器的状态。
checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];
在上面的委托方法中,存储上次移动选择器的时间。
lastPickerDate = [[NSDate date] retain];
在checkPicker方法中检查从上次移动开始经过的时间
NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];
如果timeSinceMove大于某个所需的值,即0.5秒,则将BOOL pickerMoving设置为false。 否则将其设置为true。 这不是检查运动的最精确方法,但我认为应该做的工作......
There is a UIPickerViewDelegate method which is basically triggered every time you scroll the picker
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
Set the delegate for your picker, implement this method and see what happens...
[EDIT] ok now I understand what you need. Implement a timer which checks the state of the picker.
checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];
in the above delegate method, store the last time the picker had been moved.
lastPickerDate = [[NSDate date] retain];
in the checkPicker method check how much time had elapsed from the last move
NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];
if timeSinceMove is bigger then some desired value i.e. 0.5 seconds, set your BOOL pickerMoving to false. else set it to true. This is not the most precise method to check for movement, but I think it should do the job...
相关问答
更多-
UIScrollView不滚动?(UIScrollView Not Scrolling?)[2022-06-11]
viewDidLoad即将推出。 您必须等到视图布局发生之后。 尝试在viewDidAppear中设置contentSize。 你在使用自动布局吗? 如果是这样,请检查以下答案(并忘记1.): UIScrollView不使用自动布局约束 。 viewDidLoad is to soon. You must wait until after the layout of the views has taken place. Try setting the contentSize in viewDidAppear ... -
这是一种启动视差背景的超级简单方法。 与滑行! 我希望它能帮助您理解基础知识,然后再采用更难但更有效的编码方式。 因此,我将从获得背景移动的代码开始,然后尝试复制要放置在场景中的前景或对象的代码。 //declare ground picture. If Your putting this image over the top of another image (use a png file). var groundImage = SKTexture(imageNamed: "background. ...
-
使用KVO观察集合视图的contentOffset 。 如果它位于滚动应停止的位置(或范围),请将contentOffset设置为动画。 Observe with KVO the contentOffset of the collection view. And if it's at the position (or range) where the scrolling should stop, set the contentOffset animated.
-
检查MouseEventArgs的Delta属性: 示例代码: Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel If e.Delta > 0 Then Trace.WriteLine("Scrolled up!") Else Trace.WriteLine("Scr ...
-
平滑滚动 -(Smooth Scrolling -)[2023-07-30]
滚动行为设置为仅在以下位置使用: https://indianashrm.staging.wpengine.com/job-board/#createjobposting : https://indianashrm.staging.wpengine.com/job-board/#createjobposting 和#createjobposting表单不在加载的页面中( https://indianashrm.staging.wpengine.com/job-board/graphic-designer/ ... -
有一个UIPickerViewDelegate方法,每次滚动选择器时基本上都会触发该方法 - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 设置选择器的委托,实现此方法,看看会发生什么...... [编辑]好了,我现在明白了你的需求。 实现一个计时器,检查选择器的状态。 checkTimer = [NSTimer scheduled ...
-
智能滚动(Intelligent Scrolling)[2024-04-01]
它很容易..例如使用jquery,你可以在.scroll()内调用一个函数,只要你开始滚动就触发......只需从顶部或底部使用.offset()你就可以找到你想要的任何你想要的东西 its easy.. for example with jquery you can call a function within .scroll() triggering whenever you start scrolling... just use .offset() from top or bottom and you ... -
UITableview不滚动?(UITableview Not scrolling?)[2023-04-06]
看到你的xib并检查这些东西。参见下图 try this this will clear your problem self.myTableView.bounces = YES; more info check this post -
scroll: 'no' 不是有效的CSS属性。 众所周知,IE存在iFrames和CSS overflow属性的问题。 请查看此页面以获取解决方法: http : //www.webmasterworld.com/html/3113793.htm 或者这个: http : //www.codingforums.com/showthread.php?t = 107457 真的,这里最好的解决方案是在你的iFrame标签里面使用scrolling="no" 。 确实,它不符合W3标准 - 但没有客户会因为有 ...
-
UIPickerView和UI单元测试:如何获取UIPickerWheel的值?(UIPickerView and UI Unit Test: How to get values of UIPickerWheel?)[2022-08-27]
这可能不是您希望的答案,但是无法在UITest中获取UIPickerView中所有行的标题。 如您所知,在运行UITest时,您只能通过XCUIElement类访问应用程序的UI元素。 该类有一个value属性,可以为您提供有关您访问的UI元素的一些信息。 访问UIPickerView该value会为您提供当前所选行的标题。 但只有选定的行。 您可以访问选择器的行元素,但不幸的是,行元素的value属性始终为空。 所以,这里没有运气。 您可以获得的所有信息都是拣货员的行数。 但这并不奇怪。 即使您有权访问U ...