perf: 移除临时性能监控日志,保留 Perfetto trace 标记
清理 ViewModel 和各 UI 组件中用于调试的 println 性能日志、 重组计数器和 System.nanoTime() 计时代码。正式的 composeTraceBeginSection/EndSection Perfetto/Systrace 标记继续保留, 用于生产环境性能分析。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
98f3b71c4f
commit
2bd7d5ee19
@ -25,28 +25,6 @@ import plus.rua.project.ui.COLLAPSE_THRESHOLD
|
||||
import plus.rua.project.ui.FLING_VELOCITY_THRESHOLD_DP
|
||||
import kotlin.time.Clock
|
||||
|
||||
// region 性能监控工具
|
||||
private fun perfLog(tag: String, msg: String) {
|
||||
println("[PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
|
||||
private inline fun <T> perfMeasure(tag: String, block: () -> T): T {
|
||||
val start = System.nanoTime()
|
||||
val result = block()
|
||||
val elapsedMs = (System.nanoTime() - start) / 1_000_000.0
|
||||
perfLog(tag, "elapsed=${"%.3f".format(elapsedMs)}ms")
|
||||
return result
|
||||
}
|
||||
|
||||
private inline fun <T> perfMeasureResult(tag: String, block: () -> T): T {
|
||||
val start = System.nanoTime()
|
||||
val result = block()
|
||||
val elapsedMs = (System.nanoTime() - start) / 1_000_000.0
|
||||
perfLog(tag, "result=$result elapsed=${"%.3f".format(elapsedMs)}ms")
|
||||
return result
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 日历日期数据,用于网格单元格渲染。
|
||||
*
|
||||
@ -173,53 +151,32 @@ class CalendarViewModel(
|
||||
* 当前视图被直接移除;动画只作用在目标视图的 scale/alpha 上。
|
||||
*/
|
||||
fun toggleYearView() {
|
||||
val direction = if (isYearView) "Year→Month" else "Month→Year"
|
||||
perfLog("VM.toggleYearView", "START direction=$direction isCollapsed=$isCollapsed yearViewYear=$yearViewYear selectedDate=$selectedDate")
|
||||
val toggleStart = System.nanoTime()
|
||||
yearViewJob?.cancel()
|
||||
yearViewJob = coroutineScope.launch {
|
||||
if (isYearView) {
|
||||
composeTraceBeginSection("YearView→MonthView")
|
||||
val snapStart = System.nanoTime()
|
||||
_yearViewAnimatable.snapTo(1f)
|
||||
perfLog("VM.toggleYearView", "snapTo(1f) elapsed=${(System.nanoTime() - snapStart) / 1_000_000.0}ms")
|
||||
val animJob = launch {
|
||||
val animStart = System.nanoTime()
|
||||
launch {
|
||||
_yearViewAnimatable.animateTo(
|
||||
0f, tween(400, easing = FastOutSlowInEasing)
|
||||
)
|
||||
perfLog("VM.toggleYearView", "animateTo(0f) elapsed=${(System.nanoTime() - animStart) / 1_000_000.0}ms")
|
||||
}
|
||||
val frameStart = System.nanoTime()
|
||||
withFrameNanos { }
|
||||
perfLog("VM.toggleYearView", "withFrameNanos elapsed=${(System.nanoTime() - frameStart) / 1_000_000.0}ms")
|
||||
val flipStart = System.nanoTime()
|
||||
isYearView = false
|
||||
perfLog("VM.toggleYearView", "isYearView=false flip elapsed=${(System.nanoTime() - flipStart) / 1_000_000.0}ms")
|
||||
composeTraceEndSection()
|
||||
} else {
|
||||
composeTraceBeginSection("MonthView→YearView")
|
||||
val snapStart = System.nanoTime()
|
||||
yearViewYear = selectedDate.year
|
||||
_yearViewAnimatable.snapTo(0f)
|
||||
perfLog("VM.toggleYearView", "snapTo(0f) + set yearViewYear=$yearViewYear elapsed=${(System.nanoTime() - snapStart) / 1_000_000.0}ms")
|
||||
val animJob = launch {
|
||||
val animStart = System.nanoTime()
|
||||
launch {
|
||||
_yearViewAnimatable.animateTo(
|
||||
1f, tween(400, easing = FastOutSlowInEasing)
|
||||
)
|
||||
perfLog("VM.toggleYearView", "animateTo(1f) elapsed=${(System.nanoTime() - animStart) / 1_000_000.0}ms")
|
||||
}
|
||||
val frameStart = System.nanoTime()
|
||||
withFrameNanos { }
|
||||
perfLog("VM.toggleYearView", "withFrameNanos elapsed=${(System.nanoTime() - frameStart) / 1_000_000.0}ms")
|
||||
val flipStart = System.nanoTime()
|
||||
isYearView = true
|
||||
perfLog("VM.toggleYearView", "isYearView=true flip elapsed=${(System.nanoTime() - flipStart) / 1_000_000.0}ms")
|
||||
composeTraceEndSection()
|
||||
}
|
||||
val totalMs = (System.nanoTime() - toggleStart) / 1_000_000.0
|
||||
perfLog("VM.toggleYearView", "END direction=$direction total=${"%.3f".format(totalMs)}ms")
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,27 +185,17 @@ class CalendarViewModel(
|
||||
*/
|
||||
@Suppress("DEPRECATION") // monthNumber 无替代 API
|
||||
fun selectMonthFromYearView(month: Int) {
|
||||
val totalStart = System.nanoTime()
|
||||
perfLog("VM.selectMonthFromYearView", "START month=$month yearViewYear=$yearViewYear")
|
||||
composeTraceBeginSection("YearView:SelectMonth")
|
||||
val date = if (yearViewYear == today.year && today.month.number == month) today
|
||||
else LocalDate(yearViewYear, month, 1)
|
||||
val dateSetStart = System.nanoTime()
|
||||
selectedDate = date
|
||||
perfLog("VM.selectMonthFromYearView", "selectedDate=$selectedDate elapsed=${(System.nanoTime() - dateSetStart) / 1_000_000.0}ms")
|
||||
val flipStart = System.nanoTime()
|
||||
isYearView = false
|
||||
perfLog("VM.selectMonthFromYearView", "isYearView=false elapsed=${(System.nanoTime() - flipStart) / 1_000_000.0}ms")
|
||||
yearViewJob?.cancel()
|
||||
yearViewJob = coroutineScope.launch {
|
||||
val animStart = System.nanoTime()
|
||||
_yearViewAnimatable.animateTo(
|
||||
0f, tween(400, easing = FastOutSlowInEasing)
|
||||
)
|
||||
perfLog("VM.selectMonthFromYearView", "animateTo(0f) elapsed=${(System.nanoTime() - animStart) / 1_000_000.0}ms")
|
||||
composeTraceEndSection()
|
||||
val totalMs = (System.nanoTime() - totalStart) / 1_000_000.0
|
||||
perfLog("VM.selectMonthFromYearView", "END total=${"%.3f".format(totalMs)}ms")
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,7 +326,6 @@ class CalendarViewModel(
|
||||
*/
|
||||
@Suppress("DEPRECATION") // monthNumber 无替代 API,kotlinx-datetime 尚未提供新接口
|
||||
fun getMonthDays(year: Int, month: Int): List<CalendarDay> {
|
||||
val start = System.nanoTime()
|
||||
composeTraceBeginSection("getMonthDays:$year-$month")
|
||||
val firstOfMonth = LocalDate(year, month, 1)
|
||||
val dayOfWeekOffset = firstOfMonth.dayOfWeek.ordinal
|
||||
@ -400,8 +346,6 @@ class CalendarViewModel(
|
||||
)
|
||||
}
|
||||
composeTraceEndSection()
|
||||
val elapsedMs = (System.nanoTime() - start) / 1_000_000.0
|
||||
perfLog("VM.getMonthDays", "$year-$month rows=$rows totalDays=$totalDays elapsed=${"%.3f".format(elapsedMs)}ms")
|
||||
return result
|
||||
}
|
||||
}
|
||||
@ -8,10 +8,7 @@ import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clipToBounds
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
@ -26,11 +23,6 @@ import kotlinx.datetime.number
|
||||
import kotlinx.datetime.plus
|
||||
import plus.rua.project.ShiftKind
|
||||
|
||||
// region 性能监控工具
|
||||
private fun monthPagePerfLog(tag: String, msg: String) {
|
||||
println("[MONTH-PAGE-PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 月度日历网格页面,支持两阶段折叠动画。
|
||||
@ -66,15 +58,8 @@ fun CalendarMonthPage(
|
||||
onRowHeightMeasured: ((Int) -> Unit)? = null,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val pageStart = System.nanoTime()
|
||||
var recomposeCount by remember { mutableIntStateOf(0) }
|
||||
recomposeCount++
|
||||
val days = remember(year, month) {
|
||||
val genStart = System.nanoTime()
|
||||
val result = generateMonthDays(year, month)
|
||||
val genMs = (System.nanoTime() - genStart) / 1_000_000.0
|
||||
monthPagePerfLog("CalendarMonthPage", "generateMonthDays year=$year month=$month elapsed=${"%.3f".format(genMs)}ms")
|
||||
result
|
||||
generateMonthDays(year, month)
|
||||
}
|
||||
val density = LocalDensity.current
|
||||
|
||||
@ -82,8 +67,6 @@ fun CalendarMonthPage(
|
||||
val anchorIndex = remember(weeks, selectedDate) {
|
||||
weeks.indexOfFirst { week -> week.any { it.date == selectedDate } }
|
||||
}
|
||||
val weekCount = weeks.size
|
||||
monthPagePerfLog("CalendarMonthPage", "composition #$recomposeCount year=$year month=$month weeks=$weekCount collapseProgress=$collapseProgress anchorRow=$anchorIndex")
|
||||
val hasAnchor = anchorIndex >= 0
|
||||
val h = rowHeightPx.toFloat()
|
||||
|
||||
@ -182,8 +165,6 @@ fun CalendarMonthPage(
|
||||
}
|
||||
}
|
||||
}
|
||||
val totalMs = (System.nanoTime() - pageStart) / 1_000_000.0
|
||||
monthPagePerfLog("CalendarMonthPage", "END year=$year month=$month elapsed=${"%.3f".format(totalMs)}ms")
|
||||
}
|
||||
|
||||
private data class DayData(
|
||||
|
||||
@ -77,12 +77,6 @@ import plus.rua.project.composeTraceEndSection
|
||||
import kotlin.math.abs
|
||||
import kotlin.time.Clock
|
||||
|
||||
// region 性能监控工具
|
||||
private fun uiPerfLog(tag: String, msg: String) {
|
||||
println("[UI-PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 日历主界面,包含月/周视图切换、折叠动画和年视图共享元素转场。
|
||||
*
|
||||
@ -114,10 +108,6 @@ fun CalendarMonthView(
|
||||
isMenuExpanded = false
|
||||
}
|
||||
|
||||
// 重组计数器
|
||||
var recomposeCount by remember { mutableIntStateOf(0) }
|
||||
recomposeCount++
|
||||
|
||||
val pagerState = rememberPagerState(initialPage = START_PAGE, pageCount = { Int.MAX_VALUE })
|
||||
|
||||
// 年视图分页器
|
||||
@ -158,7 +148,6 @@ fun CalendarMonthView(
|
||||
}
|
||||
}
|
||||
|
||||
uiPerfLog("CalendarMonthView", "composition #$recomposeCount isYearView=${viewModel.isYearView}")
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
@ -174,7 +163,6 @@ fun CalendarMonthView(
|
||||
targetState = viewModel.isYearView,
|
||||
label = "month_year_transition",
|
||||
transitionSpec = {
|
||||
uiPerfLog("CalendarMonthView", "AnimatedContent transitionSpec target=$targetState initial=$initialState")
|
||||
val enter = fadeIn(tween(300, easing = FastOutSlowInEasing)) +
|
||||
slideInVertically(tween(300, easing = FastOutSlowInEasing)) { it / 6 }
|
||||
val exit = fadeOut(tween(200, easing = FastOutSlowInEasing)) +
|
||||
@ -183,8 +171,6 @@ fun CalendarMonthView(
|
||||
},
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) { isYearView ->
|
||||
val contentStart = System.nanoTime()
|
||||
uiPerfLog("CalendarMonthView", "AnimatedContent content lambda START isYearView=$isYearView")
|
||||
if (!isYearView) {
|
||||
composeTraceBeginSection("MonthView:Compose")
|
||||
val layoutReady = rowHeightPx > 0
|
||||
@ -242,13 +228,9 @@ fun CalendarMonthView(
|
||||
)
|
||||
}
|
||||
}
|
||||
val monthViewMs = (System.nanoTime() - contentStart) / 1_000_000.0
|
||||
uiPerfLog("CalendarMonthView", "MonthView content lambda END elapsed=${"%.3f".format(monthViewMs)}ms")
|
||||
composeTraceEndSection()
|
||||
} else {
|
||||
composeTraceBeginSection("YearView:Compose")
|
||||
val yearViewStart = System.nanoTime()
|
||||
uiPerfLog("CalendarMonthView", "YearView:Compose START")
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
@ -273,7 +255,6 @@ fun CalendarMonthView(
|
||||
.fillMaxWidth()
|
||||
.weight(1f)
|
||||
) { page ->
|
||||
val pageStart = System.nanoTime()
|
||||
val pageOffset = abs(yearPagerState.currentPageOffsetFraction)
|
||||
val isCurrentPage = page == yearPagerState.currentPage
|
||||
val crossFadeAlpha = if (isCurrentPage) {
|
||||
@ -282,7 +263,6 @@ fun CalendarMonthView(
|
||||
pageOffset
|
||||
}
|
||||
val pageYear = viewModel.selectedDate.year + (page - START_PAGE)
|
||||
uiPerfLog("CalendarMonthView", "YearPager page=$page pageYear=$pageYear crossFadeAlpha=${"%.2f".format(crossFadeAlpha)} isCurrentPage=$isCurrentPage offset=${"%.3f".format(pageOffset)}")
|
||||
YearGridView(
|
||||
year = pageYear,
|
||||
selectedMonth = if (pageYear == currentYear) currentMonth else 0,
|
||||
@ -304,12 +284,8 @@ fun CalendarMonthView(
|
||||
)
|
||||
}
|
||||
}
|
||||
val yearViewMs = (System.nanoTime() - yearViewStart) / 1_000_000.0
|
||||
uiPerfLog("CalendarMonthView", "YearView:Compose END elapsed=${"%.3f".format(yearViewMs)}ms")
|
||||
composeTraceEndSection()
|
||||
}
|
||||
val contentTotalMs = (System.nanoTime() - contentStart) / 1_000_000.0
|
||||
uiPerfLog("CalendarMonthView", "AnimatedContent content lambda END total=${"%.3f".format(contentTotalMs)}ms")
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,10 +404,6 @@ private fun CalendarPagerArea(
|
||||
pagerState: PagerState,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val areaStart = System.nanoTime()
|
||||
var areaRecomposeCount by remember { mutableIntStateOf(0) }
|
||||
areaRecomposeCount++
|
||||
uiPerfLog("CalendarPagerArea", "composition #$areaRecomposeCount collapseProgress=${viewModel.collapseProgress} page=${pagerState.currentPage} rowHeightPx=$rowHeightPx")
|
||||
val density = LocalDensity.current
|
||||
val collapseProgress = viewModel.collapseProgress
|
||||
|
||||
@ -526,8 +498,6 @@ private fun CalendarPagerArea(
|
||||
modifier = pagerModifier
|
||||
)
|
||||
}
|
||||
val areaTotalMs = (System.nanoTime() - areaStart) / 1_000_000.0
|
||||
uiPerfLog("CalendarPagerArea", "END elapsed=${"%.3f".format(areaTotalMs)}ms")
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@ -5,11 +5,8 @@ import androidx.compose.foundation.pager.PagerDefaults
|
||||
import androidx.compose.foundation.pager.PagerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
@ -20,11 +17,6 @@ import kotlinx.datetime.number
|
||||
import plus.rua.project.ShiftKind
|
||||
import kotlin.math.abs
|
||||
|
||||
// region 性能监控工具
|
||||
private fun pagerPerfLog(tag: String, msg: String) {
|
||||
println("[PAGER-PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 月度日历分页器,HorizontalPager 实现无限左右滑动切换月份。
|
||||
@ -60,9 +52,6 @@ fun CalendarPager(
|
||||
pagerState: PagerState,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
var recomposeCount by remember { mutableIntStateOf(0) }
|
||||
recomposeCount++
|
||||
pagerPerfLog("CalendarPager", "composition #$recomposeCount selectedDate=$selectedDate collapseProgress=$collapseProgress")
|
||||
val initialYear = remember { today.year }
|
||||
|
||||
@Suppress("DEPRECATION") // monthNumber 无替代 API,kotlinx-datetime 尚未提供新接口
|
||||
@ -83,7 +72,6 @@ fun CalendarPager(
|
||||
flingBehavior = PagerDefaults.flingBehavior(state = pagerState),
|
||||
modifier = modifier
|
||||
) { page ->
|
||||
val pageComposeStart = System.nanoTime()
|
||||
val pageOffset = abs(pagerState.currentPageOffsetFraction)
|
||||
val isCurrentPage = page == pagerState.currentPage
|
||||
val alpha = if (isCurrentPage) {
|
||||
@ -122,7 +110,5 @@ fun CalendarPager(
|
||||
onRowHeightMeasured = onRowHeightMeasured,
|
||||
modifier = Modifier.alpha(alpha)
|
||||
)
|
||||
val pageComposeMs = (System.nanoTime() - pageComposeStart) / 1_000_000.0
|
||||
pagerPerfLog("CalendarPager", "page=$page year=$year month=$month alpha=${"%.2f".format(alpha)} elapsed=${"%.3f".format(pageComposeMs)}ms")
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,7 @@ import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
@ -24,11 +22,6 @@ import kotlinx.datetime.plus
|
||||
import plus.rua.project.ShiftKind
|
||||
import kotlin.math.abs
|
||||
|
||||
// region 性能监控工具
|
||||
private fun weekPerfLog(tag: String, msg: String) {
|
||||
println("[WEEK-PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 周视图分页器,折叠状态下显示选中日期所在周,支持左右滑动切换周。
|
||||
@ -51,9 +44,6 @@ fun WeekPager(
|
||||
showLegalHoliday: Boolean,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
var recomposeCount by remember { mutableIntStateOf(0) }
|
||||
recomposeCount++
|
||||
weekPerfLog("WeekPager", "composition #$recomposeCount selectedDate=$selectedDate")
|
||||
val initialWeekMonday = remember { selectedDate.toWeekMonday() }
|
||||
val pagerState = rememberPagerState(
|
||||
initialPage = START_PAGE,
|
||||
@ -82,7 +72,6 @@ fun WeekPager(
|
||||
flingBehavior = PagerDefaults.flingBehavior(state = pagerState),
|
||||
modifier = modifier
|
||||
) { page ->
|
||||
val pageStart = System.nanoTime()
|
||||
val pageOffset = abs(pagerState.currentPageOffsetFraction)
|
||||
val isCurrentPage = page == pagerState.currentPage
|
||||
val alpha = if (isCurrentPage) {
|
||||
@ -112,7 +101,5 @@ fun WeekPager(
|
||||
)
|
||||
}
|
||||
}
|
||||
val pageMs = (System.nanoTime() - pageStart) / 1_000_000.0
|
||||
weekPerfLog("WeekPager", "page=$page weekMonday=$weekMonday elapsed=${"%.3f".format(pageMs)}ms")
|
||||
}
|
||||
}
|
||||
@ -25,9 +25,7 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
@ -52,12 +50,6 @@ import plus.rua.project.composeTraceEndSection
|
||||
|
||||
private val WEEKDAY_LABELS = listOf("一", "二", "三", "四", "五", "六", "日")
|
||||
|
||||
// region 性能监控工具
|
||||
private fun yearPerfLog(tag: String, msg: String) {
|
||||
println("[YEAR-PERF:${Thread.currentThread().name}] $tag | $msg")
|
||||
}
|
||||
// endregion
|
||||
|
||||
private data class MiniMonthColors(
|
||||
val titleSelected: Color,
|
||||
val titleNormal: Color,
|
||||
@ -90,10 +82,6 @@ fun YearGridView(
|
||||
animatedVisibilityScope: AnimatedVisibilityScope,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val yearGridStart = System.nanoTime()
|
||||
var yearGridRecomposeCount by remember { mutableIntStateOf(0) }
|
||||
yearGridRecomposeCount++
|
||||
yearPerfLog("YearGridView", "composition #$yearGridRecomposeCount year=$year selectedMonth=$selectedMonth")
|
||||
composeTraceBeginSection("YearGridView:$year")
|
||||
|
||||
// P0-F: 主题色在 YearGridView 级别一次性读取并缓存
|
||||
@ -208,8 +196,6 @@ fun YearGridView(
|
||||
}
|
||||
}
|
||||
composeTraceEndSection()
|
||||
val yearGridTotalMs = (System.nanoTime() - yearGridStart) / 1_000_000.0
|
||||
yearPerfLog("YearGridView", "END year=$year elapsed=${"%.3f".format(yearGridTotalMs)}ms")
|
||||
}
|
||||
|
||||
/**
|
||||
@ -322,7 +308,6 @@ private data class MiniDayData(
|
||||
|
||||
@Suppress("DEPRECATION") // monthNumber 无替代 API
|
||||
private fun generateMiniMonthDays(year: Int, month: Int): List<MiniDayData> {
|
||||
val start = System.nanoTime()
|
||||
composeTraceBeginSection("generateMiniMonthDays:$year-$month")
|
||||
val firstOfMonth = LocalDate(year, month, 1)
|
||||
val offset = firstOfMonth.dayOfWeek.ordinal
|
||||
@ -340,8 +325,6 @@ private fun generateMiniMonthDays(year: Int, month: Int): List<MiniDayData> {
|
||||
)
|
||||
}
|
||||
composeTraceEndSection()
|
||||
val elapsedMs = (System.nanoTime() - start) / 1_000_000.0
|
||||
yearPerfLog("generateMiniMonthDays", "$year-$month rows=$rows totalDays=$totalDays elapsed=${"%.3f".format(elapsedMs)}ms")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user